1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-03 13:19:40 +00:00

Fix a bug in getPCNextRank

This commit is contained in:
scrawl 2013-05-04 12:28:12 +02:00
parent 03f4e91ceb
commit 6cd28d1156

View file

@ -292,13 +292,16 @@ namespace MWScript
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)
std::map<std::string, int> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
if (ranks.size())
{
std::map<std::string, int>::const_iterator it = ranks.begin();
if(it->second < -1 || it->second > 9)
return "";
if(it->second <= 8) // If player is at max rank, there is no next rank
@ -306,6 +309,9 @@ namespace MWScript
else
return faction->mRanks[it->second];
}
else
return faction->mRanks[0];
}
int InterpreterContext::getPCBounty() const
{