From: Holger Schemel Date: Sat, 24 Apr 2021 22:57:43 +0000 (+0200) Subject: moved adding new score entry to separate function X-Git-Tag: 4.3.0.0~184 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4886496a94259950ec6e62bbad4d67784b5d2d2d;p=rocksndiamonds.git moved adding new score entry to separate function --- diff --git a/src/game.c b/src/game.c index 5a88750f..21b4b82b 100644 --- a/src/game.c +++ b/src/game.c @@ -5041,14 +5041,12 @@ void GameEnd(void) } } -int NewHighScore(int level_nr) +static int addScoreEntry(void) { int i, l; int position = -1; boolean one_score_entry_per_name = !program.many_scores_per_name; - LoadScore(level_nr); - if (strEqual(setup.player_name, EMPTY_PLAYER_NAME) || game.score_final < scores.entry[MAX_SCORE_ENTRIES - 1].score) return -1; @@ -5111,6 +5109,15 @@ int NewHighScore(int level_nr) break; // player already there with a higher score } + return position; +} + +int NewHighScore(int level_nr) +{ + LoadScore(level_nr); + + int position = addScoreEntry(); + if (position >= 0) { SaveScoreTape(level_nr);