added last added score entry position to score info structure
authorHolger Schemel <info@artsoft.org>
Sat, 24 Apr 2021 23:31:04 +0000 (01:31 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 1 May 2021 13:38:31 +0000 (15:38 +0200)
src/files.c
src/game.c
src/main.h

index a4f7f10a786f31803e77ae160a858778a96e86c9..92bc92d53ecde4a2f053c9f1743d3fa1269fa158 100644 (file)
@@ -8435,6 +8435,10 @@ static void setScoreInfoToDefaults(void)
     scores.entry[i].score = 0;
     scores.entry[i].time = 0;
   }
+
+  scores.num_entries = 0;
+  scores.last_added = -1;
+
 }
 
 static void LoadScore_OLD(int nr)
index b85dbcae9861dfcae7df2d211ed5a51e2aeba768..6976317a65e26ae36c580d21a947599e84dd3aa1 100644 (file)
@@ -5119,9 +5119,9 @@ int NewHighScore(int level_nr)
 
   LoadScore(level_nr);
 
-  int position = addScoreEntry(&scores, &new_entry);
+  scores.last_added = addScoreEntry(&scores, &new_entry);
 
-  if (position >= 0)
+  if (scores.last_added >= 0)
   {
     SaveScore(level_nr);
 
@@ -5129,7 +5129,7 @@ int NewHighScore(int level_nr)
       SaveScoreTape(level_nr);
   }
 
-  return position;
+  return scores.last_added;
 }
 
 static int getElementMoveStepsizeExt(int x, int y, int direction)
index b429c15b992a998188a7a28c8ca32f2e3ee7f629..fbd2090631893dc103aeb7b848ebe0452f868570 100644 (file)
@@ -3055,6 +3055,7 @@ struct ScoreInfo
   int level_nr;
 
   int num_entries;
+  int last_added;
 
   struct ScoreEntry entry[MAX_SCORE_ENTRIES];
 };