1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00
This commit is contained in:
Laserlicht
2025-07-05 15:56:15 +02:00
parent 5fcb64911d
commit fc24eef7a5

View File

@@ -273,8 +273,11 @@ int CHighScoreInputScreen::addEntry(std::string text) {
newNode["points"].Integer() = calc.calculate().cheater ? 0 : calc.calculate().total;
newNode["datetime"].String() = TextOperations::getFormattedDateTimeLocal(std::time(nullptr));
newNode["posFlag"].Bool() = true;
JsonSerializer ser(nullptr, newNode);
ser.serializeStruct("statistic", stat);
if(!calc.isCampaign)
{
JsonSerializer ser(nullptr, newNode);
ser.serializeStruct("statistic", stat);
}
if (baseNode.size() > HIGHSCORE_ROW_SAVE - 1)
baseNode.resize(HIGHSCORE_ROW_SAVE - 1);
@@ -284,7 +287,7 @@ int CHighScoreInputScreen::addEntry(std::string text) {
int pos = -1;
for (int i = 0; i < baseNode.size(); i++)
{
if(i >= Statistic::STAT_ROW_SAVE && baseNode[i]["posFlag"].isNull())
if(!baseNode[i]["statistic"].isNull() && i >= Statistic::STAT_ROW_SAVE && baseNode[i]["posFlag"].isNull())
baseNode[i]["statistic"].clear();
if(!baseNode[i]["posFlag"].isNull())