1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00

post merge fix: bringing code more in line with our naming standards and fixing an invalid name (names starting with double underscore are reserved in C++)

This commit is contained in:
Marc Zinnschlag 2013-01-03 09:55:48 +01:00
parent c0260697c2
commit 25d9918765

View File

@ -179,17 +179,17 @@ namespace MWScript
std::vector<std::string> 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<int> actions = MWBase::Environment::get().getInputManager()->getActionSorting ();
@ -205,19 +205,19 @@ namespace MWScript
return "None";
}
std::string InterpreterContext::getNPCName() const
{
ESM::NPC npc = *mReference.get<ESM::NPC>()->mBase;
return npc.mName;
}
std::string InterpreterContext::getNPCRace() const
{
ESM::NPC npc = *mReference.get<ESM::NPC>()->mBase;
return npc.mRace;
}
std::string InterpreterContext::getNPCClass() const
{
ESM::NPC npc = *mReference.get<ESM::NPC>()->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<ESM::Faction>().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<ESM::NPC>()->mBase->mRace;
const ESM::Race* _race = world->getStore().get<ESM::Race>().find(race);
return _race->mName;
return world->getStore().get<ESM::Race>().find(race)->mName;
}
std::string InterpreterContext::getPCClass() const
{
MWBase::World *world = MWBase::Environment::get().getWorld();
std::string _class = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mClass;
const ESM::Class* __class = world->getStore().get<ESM::Class>().find(_class);
return __class->mName;
std::string class_ = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mClass;
return world->getStore().get<ESM::Class>().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<std::string, int> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
std::map<std::string, int>::const_iterator it = ranks.begin();
const MWWorld::ESMStore &store = world->getStore();
const ESM::Faction *faction = store.get<ESM::Faction>().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<std::string, int> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
std::map<std::string, int>::const_iterator it = ranks.begin();
const MWWorld::ESMStore &store = world->getStore();
const ESM::Faction *faction = store.get<ESM::Faction>().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();