From a4427235df8df1d4e1094fc97739618269af56f9 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Tue, 16 Aug 2022 01:43:28 +0300 Subject: [PATCH] Update both instances of level detail text --- apps/openmw/mwgui/statswindow.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index f3d98a4fcd..208f0a8fda 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -331,6 +331,19 @@ namespace MWGui MWWorld::Ptr player = MWMechanics::getPlayer(); const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player); + std::string detailText; + std::stringstream detail; + for (int attribute = 0; attribute < ESM::Attribute::Length; ++attribute) + { + float mult = PCstats.getLevelupAttributeMultiplier(attribute); + mult = std::min(mult, 100 - PCstats.getAttribute(attribute).getBase()); + if (mult > 1) + detail << (detail.str().empty() ? "" : "\n") << "#{" + << MyGUI::TextIterator::toTagsString(ESM::Attribute::sGmstAttributeIds[attribute]) + << "} x" << MyGUI::utility::toString(mult); + } + detailText = MyGUI::LanguageManager::getInstance().replaceTags(detail.str()); + // level progress MyGUI::Widget* levelWidget; for (int i=0; i<2; ++i) @@ -342,18 +355,8 @@ namespace MWGui levelWidget->setUserString("Range_LevelProgress", MyGUI::utility::toString(max)); levelWidget->setUserString("Caption_LevelProgressText", MyGUI::utility::toString(PCstats.getLevelProgress()) + "/" + MyGUI::utility::toString(max)); + levelWidget->setUserString("Caption_LevelDetailText", detailText); } - std::stringstream detail; - for (int attribute = 0; attribute < ESM::Attribute::Length; ++attribute) - { - float mult = PCstats.getLevelupAttributeMultiplier(attribute); - mult = std::min(mult, 100 - PCstats.getAttribute(attribute).getBase()); - if (mult > 1) - detail << (detail.str().empty() ? "" : "\n") << "#{" - << MyGUI::TextIterator::toTagsString(ESM::Attribute::sGmstAttributeIds[attribute]) - << "} x" << MyGUI::utility::toString(mult); - } - levelWidget->setUserString("Caption_LevelDetailText", MyGUI::LanguageManager::getInstance().replaceTags(detail.str())); setFactions(PCstats.getFactionRanks()); setExpelled(PCstats.getExpelled ());