From 37f270324430008a6b1a213dc0fabcfa785576ef Mon Sep 17 00:00:00 2001 From: thrust26 Date: Wed, 26 Feb 2020 23:06:15 +0100 Subject: [PATCH 1/2] a bit of formatting and artifacts cleanup --- src/common/HighScoresManager.cxx | 14 +++++++++----- src/gui/GameInfoDialog.cxx | 9 ++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/common/HighScoresManager.cxx b/src/common/HighScoresManager.cxx index 33e98e1ef..e53433dbf 100644 --- a/src/common/HighScoresManager.cxx +++ b/src/common/HighScoresManager.cxx @@ -541,10 +541,14 @@ string HighScoresManager::fromPropString(const string& text) const } // some ugly formatting - char first = result[0]; - result = BSPF::toLowerCase(result); - result[0] = first; + if(result.length()) + { + char first = result[0]; + result = BSPF::toLowerCase(result); + result[0] = first; + } - return result; + // remove leading spaces (especially for empty values) + size_t start = result.find_first_not_of(" "); + return (start == std::string::npos) ? "" : result.substr(start); } - diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index d5507063c..98ad978d7 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -807,11 +807,14 @@ void GameInfoDialog::loadHighScoresProperties(const Properties& props) mySpecialAddress->setText(ss.str()); - for (uInt32 a = 0; a < instance().highScores().numAddrBytes(info.numDigits, info.trailingZeroes); ++a) + for (uInt32 a = 0; a < HSM::MAX_SCORE_ADDR; ++a) { ss.str(""); - ss << hex << right //<< setw(HSM::MAX_ADDR_CHARS) << setfill(' ') - << uppercase << info.scoreAddr[a]; + if(a < instance().highScores().numAddrBytes(info.numDigits, info.trailingZeroes)) + { + ss << hex << right //<< setw(HSM::MAX_ADDR_CHARS) << setfill(' ') + << uppercase << info.scoreAddr[a]; + } myScoreAddress[a]->setText(ss.str()); } updateHighScoresWidgets(); From da70ec4eda04a7268a71846b071b6d990d468be2 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sat, 29 Feb 2020 23:18:41 +0100 Subject: [PATCH 2/2] a cosmetic change in HighScoresDialog --- src/gui/HighScoresDialog.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/HighScoresDialog.cxx b/src/gui/HighScoresDialog.cxx index 246f3fdcb..8afa0719a 100644 --- a/src/gui/HighScoresDialog.cxx +++ b/src/gui/HighScoresDialog.cxx @@ -212,7 +212,10 @@ void HighScoresDialog::loadConfig() label = label.substr(label.length() - 5); mySpecialLabelWidget->setLabel(label); - myNotesWidget->setLabel("Note: " + instance().highScores().notes()); + if(!instance().highScores().notes().empty()) + myNotesWidget->setLabel("Note: " + instance().highScores().notes()); + else + myNotesWidget->setLabel(""); if (instance().hasConsole()) myMD5 = instance().console().properties().get(PropType::Cart_MD5);