1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

always show actual entry

This commit is contained in:
Laserlicht 2023-09-23 22:45:38 +02:00 committed by GitHub
parent 8a0565eb9b
commit 96df11a6f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,10 +158,12 @@ void CHighScoreScreen::addHighScores()
auto & data = persistentStorage["highscore"][highscorepage == HighScorePage::SCENARIO ? "scenario" : "campaign"];
for (int i = 0; i < 11; i++)
{
auto & curData = data[i];
ColorRGBA color = (i == highlighted) ? Colors::YELLOW : Colors::WHITE;
bool currentGameNotInListEntry = (i == 10 && highlighted > 10);
auto & curData = data[currentGameNotInListEntry ? highlighted : i];
texts.push_back(std::make_shared<CLabel>(115, y + i * 50, FONT_MEDIUM, ETextAlignment::CENTER, color, std::to_string(i + 1)));
ColorRGBA color = (i == highlighted || currentGameNotInListEntry) ? Colors::YELLOW : Colors::WHITE;
texts.push_back(std::make_shared<CLabel>(115, y + i * 50, FONT_MEDIUM, ETextAlignment::CENTER, color, std::to_string((currentGameNotInListEntry ? highlighted : i) + 1)));
std::string tmp = curData["player"].String();
TextOperations::trimRightUnicode(tmp, std::max(0, (int)TextOperations::getUnicodeCharactersCount(tmp) - 13));
texts.push_back(std::make_shared<CLabel>(225, y + i * 50, FONT_MEDIUM, ETextAlignment::CENTER, color, tmp));