1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-25 13:11:37 +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 std::vector<std::string> InterpreterContext::getGlobals () const
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
return world->getGlobals(); return world->getGlobals();
} }
char InterpreterContext::getGlobalType (const std::string& name) const 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); return world->getGlobalVariableType(name);
} }
std::string InterpreterContext::getActionBinding(const std::string& action) const std::string InterpreterContext::getActionBinding(const std::string& action) const
{ {
std::vector<int> actions = MWBase::Environment::get().getInputManager()->getActionSorting (); std::vector<int> actions = MWBase::Environment::get().getInputManager()->getActionSorting ();
@ -205,19 +205,19 @@ namespace MWScript
return "None"; return "None";
} }
std::string InterpreterContext::getNPCName() const std::string InterpreterContext::getNPCName() const
{ {
ESM::NPC npc = *mReference.get<ESM::NPC>()->mBase; ESM::NPC npc = *mReference.get<ESM::NPC>()->mBase;
return npc.mName; return npc.mName;
} }
std::string InterpreterContext::getNPCRace() const std::string InterpreterContext::getNPCRace() const
{ {
ESM::NPC npc = *mReference.get<ESM::NPC>()->mBase; ESM::NPC npc = *mReference.get<ESM::NPC>()->mBase;
return npc.mRace; return npc.mRace;
} }
std::string InterpreterContext::getNPCClass() const std::string InterpreterContext::getNPCClass() const
{ {
ESM::NPC npc = *mReference.get<ESM::NPC>()->mBase; ESM::NPC npc = *mReference.get<ESM::NPC>()->mBase;
@ -238,7 +238,7 @@ namespace MWScript
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
const MWWorld::ESMStore &store = world->getStore(); const MWWorld::ESMStore &store = world->getStore();
const ESM::Faction *faction = store.get<ESM::Faction>().find(it->first); const ESM::Faction *faction = store.get<ESM::Faction>().find(it->first);
return faction->mRanks[it->second]; return faction->mRanks[it->second];
} }
@ -253,66 +253,64 @@ namespace MWScript
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
std::string race = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mRace; std::string race = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mRace;
const ESM::Race* _race = world->getStore().get<ESM::Race>().find(race); return world->getStore().get<ESM::Race>().find(race)->mName;
return _race->mName;
} }
std::string InterpreterContext::getPCClass() const std::string InterpreterContext::getPCClass() const
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
std::string _class = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mClass; std::string class_ = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mClass;
const ESM::Class* __class = world->getStore().get<ESM::Class>().find(_class); return world->getStore().get<ESM::Class>().find(class_)->mName;
return __class->mName;
} }
std::string InterpreterContext::getPCRank() const std::string InterpreterContext::getPCRank() const
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayer().getPlayer(); MWWorld::Ptr player = world->getPlayer().getPlayer();
std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; 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> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
std::map<std::string, int>::const_iterator it = ranks.begin(); std::map<std::string, int>::const_iterator it = ranks.begin();
const MWWorld::ESMStore &store = world->getStore(); const MWWorld::ESMStore &store = world->getStore();
const ESM::Faction *faction = store.get<ESM::Faction>().find(factionId); const ESM::Faction *faction = store.get<ESM::Faction>().find(factionId);
if(it->second < 0 || it->second > 9) // there are only 10 ranks if(it->second < 0 || it->second > 9) // there are only 10 ranks
return ""; return "";
return faction->mRanks[it->second]; return faction->mRanks[it->second];
} }
std::string InterpreterContext::getPCNextRank() const std::string InterpreterContext::getPCNextRank() const
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayer().getPlayer(); MWWorld::Ptr player = world->getPlayer().getPlayer();
std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; 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> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
std::map<std::string, int>::const_iterator it = ranks.begin(); std::map<std::string, int>::const_iterator it = ranks.begin();
const MWWorld::ESMStore &store = world->getStore(); const MWWorld::ESMStore &store = world->getStore();
const ESM::Faction *faction = store.get<ESM::Faction>().find(factionId); const ESM::Faction *faction = store.get<ESM::Faction>().find(factionId);
if(it->second < 0 || it->second > 9) if(it->second < 0 || it->second > 9)
return ""; return "";
if(it->second <= 8) // If player is at max rank, there is no next rank if(it->second <= 8) // If player is at max rank, there is no next rank
return faction->mRanks[it->second + 1]; return faction->mRanks[it->second + 1];
else else
return faction->mRanks[it->second]; return faction->mRanks[it->second];
} }
int InterpreterContext::getPCBounty() const int InterpreterContext::getPCBounty() const
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayer().getPlayer(); MWWorld::Ptr player = world->getPlayer().getPlayer();
return MWWorld::Class::get (player).getNpcStats (player).getBounty(); return MWWorld::Class::get (player).getNpcStats (player).getBounty();
} }
std::string InterpreterContext::getCurrentCellName() const std::string InterpreterContext::getCurrentCellName() const
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();