added using server score if higher than (potentially truncated) local score
authorHolger Schemel <info@artsoft.org>
Sun, 6 Feb 2022 14:42:45 +0000 (15:42 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 6 Feb 2022 14:42:45 +0000 (15:42 +0100)
src/game.c

index 43a0b8c2eeb12fb2086795b6f2903a68a81e9ebc..defb1d08802b16814dc27065efd95ddd776bf296 100644 (file)
@@ -5094,7 +5094,14 @@ static int addScoreEntry(struct ScoreInfo *list, struct ScoreEntry *new_entry,
     // (special case: historic score entries have an empty tape basename entry)
     if (strEqual(new_entry->tape_basename, entry->tape_basename) &&
        !strEqual(new_entry->tape_basename, UNDEFINED_FILENAME))
+    {
+      // special case: use server score instead of local score value if higher
+      // (historic scores might have been truncated to 16-bit values locally)
+      if (score_is_better)
+       entry->score = new_entry->score;
+
       return -1;
+    }
 
     if (is_better || entry_is_empty)
     {