From: Holger Schemel Date: Sat, 24 Apr 2021 23:31:04 +0000 (+0200) Subject: added last added score entry position to score info structure X-Git-Tag: 4.3.0.0~180 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=7edd2090733b5f65f7c68ec5737f836f4b513b11;p=rocksndiamonds.git added last added score entry position to score info structure --- diff --git a/src/files.c b/src/files.c index a4f7f10a..92bc92d5 100644 --- a/src/files.c +++ b/src/files.c @@ -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) diff --git a/src/game.c b/src/game.c index b85dbcae..6976317a 100644 --- a/src/game.c +++ b/src/game.c @@ -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) diff --git a/src/main.h b/src/main.h index b429c15b..fbd20906 100644 --- a/src/main.h +++ b/src/main.h @@ -3055,6 +3055,7 @@ struct ScoreInfo int level_nr; int num_entries; + int last_added; struct ScoreEntry entry[MAX_SCORE_ENTRIES]; };