From: Holger Schemel Date: Fri, 8 Mar 2024 17:54:45 +0000 (+0100) Subject: moved code to separate function X-Git-Tag: 4.4.0.0-test-1~232 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=7a5e1469c7df6a9f07717f5a9c0e7b8d9a796a2c;p=rocksndiamonds.git moved code to separate function --- diff --git a/src/game.c b/src/game.c index 8982004f..83b0c1f3 100644 --- a/src/game.c +++ b/src/game.c @@ -4906,6 +4906,27 @@ static void LevelSolved(void) LevelSolved_SetFinalGameValues(); } +static void AdvanceToNextLevel(void) +{ + if (setup.increment_levels && + level_nr < leveldir_current->last_level && + !network_playing) + { + level_nr++; // advance to next level + TapeErase(); // start with empty tape + + if (setup.auto_play_next_level) + { + scores.continue_playing = TRUE; + scores.next_level_nr = level_nr; + + LoadLevel(level_nr); + + SaveLevelSetup_SeriesInfo(); + } + } +} + void GameWon(void) { static int time_count_steps; @@ -5183,23 +5204,8 @@ void GameEnd(void) // save score and score tape before potentially erasing tape below NewHighScore(last_level_nr, tape_saved); - if (setup.increment_levels && - level_nr < leveldir_current->last_level && - !network_playing) - { - level_nr++; // advance to next level - TapeErase(); // start with empty tape - - if (setup.auto_play_next_level) - { - scores.continue_playing = TRUE; - scores.next_level_nr = level_nr; - - LoadLevel(level_nr); - - SaveLevelSetup_SeriesInfo(); - } - } + // increment and load next level (if possible and not configured otherwise) + AdvanceToNextLevel(); if (scores.last_added >= 0 && setup.show_scores_after_game) {