diff --git a/client/mainmenu/CHighScoreScreen.cpp b/client/mainmenu/CHighScoreScreen.cpp index 68094fe39..bc46f4816 100644 --- a/client/mainmenu/CHighScoreScreen.cpp +++ b/client/mainmenu/CHighScoreScreen.cpp @@ -279,15 +279,17 @@ int CHighScoreInputScreen::addEntry(std::string text) { ser.serializeStruct("statistic", stat); } - if (baseNode.size() > HIGHSCORE_ROW_SAVE - 1) - baseNode.resize(HIGHSCORE_ROW_SAVE - 1); + int highscoreEntriesCap = settings["general"]["highscoreEntriesCap"].Integer(); + if (baseNode.size() > highscoreEntriesCap - 1) + baseNode.resize(highscoreEntriesCap - 1); + baseNode.push_back(newNode); boost::range::sort(baseNode, sortFunctor); int pos = -1; for (int i = 0; i < baseNode.size(); i++) { - if(!baseNode[i]["statistic"].isNull() && i >= Statistic::STAT_ROW_SAVE && baseNode[i]["posFlag"].isNull()) + if(!baseNode[i]["statistic"].isNull() && i >= settings["general"]["highscoreStatisticEntriesCap"].Integer() && baseNode[i]["posFlag"].isNull()) baseNode[i]["statistic"].clear(); if(!baseNode[i]["posFlag"].isNull()) diff --git a/client/mainmenu/CHighScoreScreen.h b/client/mainmenu/CHighScoreScreen.h index 7f1075e93..2ee069f95 100644 --- a/client/mainmenu/CHighScoreScreen.h +++ b/client/mainmenu/CHighScoreScreen.h @@ -76,8 +76,6 @@ public: class CHighScoreInputScreen : public CWindowObject, public IVideoHolder { - const int HIGHSCORE_ROW_SAVE = 100; - std::vector> texts; std::shared_ptr input; std::shared_ptr background; diff --git a/config/schemas/settings.json b/config/schemas/settings.json index 7cdf9f685..af3a3d5da 100644 --- a/config/schemas/settings.json +++ b/config/schemas/settings.json @@ -46,7 +46,9 @@ "enableOverlay", "lastKindomInterface", "enableSubtitle", - "ignoreMuteSwitch" + "ignoreMuteSwitch", + "highscoreEntriesCap", + "highscoreStatisticEntriesCap" ], "properties" : { "playerName" : { @@ -166,6 +168,14 @@ "ignoreMuteSwitch" : { "type": "boolean", "default": true + }, + "highscoreEntriesCap" : { + "type" : "number", + "default" : 100 + }, + "highscoreStatisticEntriesCap" : { + "type" : "number", + "default" : 15 } } }, diff --git a/lib/gameState/GameStatistics.h b/lib/gameState/GameStatistics.h index 5b222061a..2157b4e0f 100644 --- a/lib/gameState/GameStatistics.h +++ b/lib/gameState/GameStatistics.h @@ -155,8 +155,6 @@ public: class DLL_LINKAGE Statistic { public: - static const int STAT_ROW_SAVE = 15; - static int getNumberOfArts(const PlayerState * ps); static int getNumberOfDwellings(const PlayerState * ps); static si64 getArmyStrength(const PlayerState * ps, bool withTownGarrison = false);