Small improvements for High Scores dialog

relates to #9716
This commit is contained in:
Ihar Hubchyk
2026-10-11 20:25:48 +08:00
parent 08602be2fa
commit d4e8e1afa6
+8 -2
View File
@@ -73,7 +73,7 @@ namespace fheroes2
namespace
{
const std::string highScoreFileName = "fheroes2.hgs";
const std::string_view highScoreFileName{ "fheroes2.hgs" };
fheroes2::HighScoreDataContainer highScoreDataContainer;
const int32_t initialHighScoreEntryOffsetY = 72;
const int32_t highScoreEntryStepY = 40;
@@ -85,6 +85,8 @@ namespace
const int32_t monsterOffsetX = 554;
const int32_t monsterOffsetY = 91;
constexpr size_t maxDisplayedEntries{ 10 };
// Calculate the mini monster sprites ROI.
fheroes2::Rect getAnimationRoi( const fheroes2::Point & position, const bool isCampaign )
{
@@ -203,7 +205,11 @@ namespace
int32_t scoreIndex = 0;
int32_t offsetY = position.y;
for ( const fheroes2::HighscoreData & data : highScores ) {
const size_t entryCount{ std::min<size_t>( maxDisplayedEntries, highScores.size() ) };
for ( size_t i = 0; i < entryCount; ++i ) {
const fheroes2::HighscoreData & data = highScores[i];
const fheroes2::FontType font = ( scoreIndex == selectedScoreIndex ) ? fheroes2::FontType::normalYellow() : fheroes2::FontType::normalWhite();
// TODO: scenario name can have its own independent language.