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:
parent
03f4e91ceb
commit
6cd28d1156
1 changed files with 14 additions and 8 deletions
|
@ -292,19 +292,25 @@ namespace MWScript
|
||||||
|
|
||||||
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>::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)
|
std::map<std::string, int> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
|
||||||
return "";
|
|
||||||
|
|
||||||
if(it->second <= 8) // If player is at max rank, there is no next rank
|
if (ranks.size())
|
||||||
return faction->mRanks[it->second + 1];
|
{
|
||||||
|
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
|
||||||
|
return faction->mRanks[it->second + 1];
|
||||||
|
else
|
||||||
|
return faction->mRanks[it->second];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return faction->mRanks[it->second];
|
return faction->mRanks[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterpreterContext::getPCBounty() const
|
int InterpreterContext::getPCBounty() const
|
||||||
|
|
Loading…
Reference in a new issue