diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index a8d615d89a..c74e3f1633 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -179,17 +179,17 @@ namespace MWScript std::vector InterpreterContext::getGlobals () const { - MWBase::World *world = MWBase::Environment::get().getWorld(); + MWBase::World *world = MWBase::Environment::get().getWorld(); return world->getGlobals(); } - + char InterpreterContext::getGlobalType (const std::string& name) const { - MWBase::World *world = MWBase::Environment::get().getWorld(); + MWBase::World *world = MWBase::Environment::get().getWorld(); return world->getGlobalVariableType(name); } - + std::string InterpreterContext::getActionBinding(const std::string& action) const { std::vector actions = MWBase::Environment::get().getInputManager()->getActionSorting (); @@ -205,19 +205,19 @@ namespace MWScript return "None"; } - + std::string InterpreterContext::getNPCName() const { ESM::NPC npc = *mReference.get()->mBase; return npc.mName; } - + std::string InterpreterContext::getNPCRace() const { ESM::NPC npc = *mReference.get()->mBase; return npc.mRace; } - + std::string InterpreterContext::getNPCClass() const { ESM::NPC npc = *mReference.get()->mBase; @@ -238,7 +238,7 @@ namespace MWScript MWBase::World *world = MWBase::Environment::get().getWorld(); const MWWorld::ESMStore &store = world->getStore(); const ESM::Faction *faction = store.get().find(it->first); - + return faction->mRanks[it->second]; } @@ -253,66 +253,64 @@ namespace MWScript { MWBase::World *world = MWBase::Environment::get().getWorld(); std::string race = world->getPlayer().getPlayer().get()->mBase->mRace; - const ESM::Race* _race = world->getStore().get().find(race); - return _race->mName; + return world->getStore().get().find(race)->mName; } std::string InterpreterContext::getPCClass() const { MWBase::World *world = MWBase::Environment::get().getWorld(); - std::string _class = world->getPlayer().getPlayer().get()->mBase->mClass; - const ESM::Class* __class = world->getStore().get().find(_class); - return __class->mName; + std::string class_ = world->getPlayer().getPlayer().get()->mBase->mClass; + return world->getStore().get().find(class_)->mName; } - + std::string InterpreterContext::getPCRank() const { MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayer().getPlayer(); - + std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; - + std::map ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks(); std::map::const_iterator it = ranks.begin(); const MWWorld::ESMStore &store = world->getStore(); const ESM::Faction *faction = store.get().find(factionId); - + if(it->second < 0 || it->second > 9) // there are only 10 ranks return ""; - + return faction->mRanks[it->second]; - } + } std::string InterpreterContext::getPCNextRank() const { MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayer().getPlayer(); - + std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; - + std::map ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks(); std::map::const_iterator it = ranks.begin(); const MWWorld::ESMStore &store = world->getStore(); const ESM::Faction *faction = store.get().find(factionId); - + if(it->second < 0 || it->second > 9) return ""; - + if(it->second <= 8) // If player is at max rank, there is no next rank return faction->mRanks[it->second + 1]; else return faction->mRanks[it->second]; } - + int InterpreterContext::getPCBounty() const { MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayer().getPlayer(); return MWWorld::Class::get (player).getNpcStats (player).getBounty(); } - + std::string InterpreterContext::getCurrentCellName() const { MWBase::World *world = MWBase::Environment::get().getWorld();