1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 19:21:04 +00:00

Don't show nameless higher ranks

This commit is contained in:
Evil Eye 2024-04-08 17:54:13 +02:00
parent c29816f67e
commit 1ed82662ee
2 changed files with 6 additions and 6 deletions

View File

@ -223,6 +223,7 @@
Feature #7860: Lua: Expose NPC AI settings (fight, alarm, flee) Feature #7860: Lua: Expose NPC AI settings (fight, alarm, flee)
Feature #7875: Disable MyGUI windows snapping Feature #7875: Disable MyGUI windows snapping
Feature #7914: Do not allow to move GUI windows out of screen Feature #7914: Do not allow to move GUI windows out of screen
Feature #7923: Don't show non-existent higher ranks for factions with fewer than 9 ranks
Task #5896: Do not use deprecated MyGUI properties Task #5896: Do not use deprecated MyGUI properties
Task #6085: Replace boost::filesystem with std::filesystem Task #6085: Replace boost::filesystem with std::filesystem
Task #6149: Dehardcode Lua API_REVISION Task #6149: Dehardcode Lua API_REVISION

View File

@ -582,9 +582,8 @@ namespace MWGui
const std::set<ESM::RefId>& expelled = PCstats.getExpelled(); const std::set<ESM::RefId>& expelled = PCstats.getExpelled();
bool firstFaction = true; bool firstFaction = true;
for (auto& factionPair : mFactions) for (const auto& [factionId, factionRank] : mFactions)
{ {
const ESM::RefId& factionId = factionPair.first;
const ESM::Faction* faction = store.get<ESM::Faction>().find(factionId); const ESM::Faction* faction = store.get<ESM::Faction>().find(factionId);
if (faction->mData.mIsHidden == 1) if (faction->mData.mIsHidden == 1)
continue; continue;
@ -611,10 +610,10 @@ namespace MWGui
text += "\n#{fontcolourhtml=normal}#{sExpelled}"; text += "\n#{fontcolourhtml=normal}#{sExpelled}";
else else
{ {
const int rank = std::clamp(factionPair.second, 0, 9); const auto rank = static_cast<size_t>(std::max(0, factionRank));
text += std::string("\n#{fontcolourhtml=normal}") + faction->mRanks[rank]; if (rank < faction->mRanks.size())
text += std::string("\n#{fontcolourhtml=normal}") + faction->mRanks[rank];
if (rank < 9) if (rank + 1 < faction->mRanks.size() && !faction->mRanks[rank + 1].empty())
{ {
// player doesn't have max rank yet // player doesn't have max rank yet
text += std::string("\n\n#{fontcolourhtml=header}#{sNextRank} ") + faction->mRanks[rank + 1]; text += std::string("\n\n#{fontcolourhtml=header}#{sNextRank} ") + faction->mRanks[rank + 1];