From 5c62d90c1b7bd9627b2e6f5175b6aa1b145258d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 Apr 2018 18:25:41 -0400 Subject: XEEN: Fix display of negative values in Character dialog HP tooltip --- engines/xeen/dialogs/dialogs_char_info.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'engines/xeen') diff --git a/engines/xeen/dialogs/dialogs_char_info.cpp b/engines/xeen/dialogs/dialogs_char_info.cpp index 08b9aed8b1..aec8be5ee4 100644 --- a/engines/xeen/dialogs/dialogs_char_info.cpp +++ b/engines/xeen/dialogs/dialogs_char_info.cpp @@ -396,14 +396,18 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { bounds.setHeight(42); break; - case 10: + case 10: { // Hit Points - stat1 = c._currentHp; - stat2 = c.getMaxHP(); - msg = Common::String::format(Res.CURRENT_MAXIMUM_TEXT, Res.STAT_NAMES[attrib], - stat1, stat2); + Common::String fmt(Res.CURRENT_MAXIMUM_TEXT); + const char *p; + while ((p = strstr(fmt.c_str(), "%u")) != nullptr) + fmt.setChar('d', p - fmt.c_str() + 1); + + msg = Common::String::format(fmt.c_str(), Res.STAT_NAMES[attrib], + c._currentHp, c.getMaxHP()); bounds.setHeight(42); break; + } case 11: // Spell Points -- cgit v1.2.3