From 707f45aa8e758ef34da14cffc83dbf6c992f4008 Mon Sep 17 00:00:00 2001 From: Jordan Ayers Date: Sun, 6 Oct 2013 19:46:04 -0500 Subject: [PATCH] Magic Effect Display improvement. Related to Bug #794. Always show one decimal point precision for Fortify Max. Magicka effect. --- apps/openmw/mwgui/spellicons.cpp | 7 ++++++- apps/openmw/mwgui/widgets.cpp | 17 +++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwgui/spellicons.cpp b/apps/openmw/mwgui/spellicons.cpp index e7a1f32a4d..93727ed7fa 100644 --- a/apps/openmw/mwgui/spellicons.cpp +++ b/apps/openmw/mwgui/spellicons.cpp @@ -2,6 +2,9 @@ #include +#include +#include + #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" @@ -174,7 +177,9 @@ namespace MWGui if (it->first == 84) // special handling for fortify maximum magicka { std::string timesInt = MWBase::Environment::get().getWindowManager()->getGameSettingString("sXTimesINT", ""); - sourcesDescription += " " + boost::lexical_cast(effectIt->mMagnitude / 10.0f) + timesInt; + std::stringstream formatter; + formatter << std::fixed << std::setprecision(1) << " " << (effectIt->mMagnitude / 10.0f) << timesInt; + sourcesDescription += formatter.str(); } else { diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index d435dd6f93..e46838a647 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -2,6 +2,9 @@ #include +#include +#include + #include #include #include @@ -429,12 +432,14 @@ namespace MWGui { std::string timesInt = MWBase::Environment::get().getWindowManager()->getGameSettingString("sXTimesINT", ""); std::string times = MWBase::Environment::get().getWindowManager()->getGameSettingString("sXTimes", ""); - if (mEffectParams.mMagnMin == mEffectParams.mMagnMax) - spellLine += " " + boost::lexical_cast(mEffectParams.mMagnMin / 10.0f) + timesInt; - else - { - spellLine += " " + boost::lexical_cast(mEffectParams.mMagnMin / 10.0f) + times + " " + to + boost::lexical_cast(mEffectParams.mMagnMax / 10.0f) + timesInt; - } + std::stringstream formatter; + + formatter << std::fixed << std::setprecision(1) << " " << (mEffectParams.mMagnMin / 10.0f); + if (mEffectParams.mMagnMin != mEffectParams.mMagnMax) + formatter << times << " " << to << " " << (mEffectParams.mMagnMax / 10.0f); + formatter << timesInt; + + spellLine += formatter.str(); } else {