fixed checking player name when adding new score entry
authorHolger Schemel <info@artsoft.org>
Tue, 11 May 2021 18:03:26 +0000 (20:03 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 11 May 2021 18:03:26 +0000 (20:03 +0200)
src/game.c

index 79ee535e7956a2c2ae4cf9764058e7e1d811c30e..6d5cf55307e91f756000f5a71c101ee3be496972 100644 (file)
@@ -5046,7 +5046,7 @@ static int addScoreEntry(struct ScoreInfo *list, struct ScoreEntry *new_entry)
   boolean one_score_entry_per_name = !program.many_scores_per_name;
   int i;
 
-  if (strEqual(setup.player_name, EMPTY_PLAYER_NAME))
+  if (strEqual(new_entry->name, EMPTY_PLAYER_NAME))
     return -1;
 
   for (i = 0; i < MAX_SCORE_ENTRIES; i++)
@@ -5081,7 +5081,7 @@ static int addScoreEntry(struct ScoreInfo *list, struct ScoreEntry *new_entry)
        if (one_score_entry_per_name)
        {
          for (l = i; l < MAX_SCORE_ENTRIES; l++)
-           if (strEqual(list->entry[l].name, setup.player_name))
+           if (strEqual(list->entry[l].name, new_entry->name))
              m = l;
 
          if (m == i)   // player's new highscore overwrites his old one
@@ -5099,7 +5099,7 @@ static int addScoreEntry(struct ScoreInfo *list, struct ScoreEntry *new_entry)
       return i;
     }
     else if (one_score_entry_per_name &&
-            strEqual(entry->name, setup.player_name))
+            strEqual(entry->name, new_entry->name))
     {
       // player already in high score list with better score or time