From: Holger Schemel Date: Thu, 21 Jun 2018 06:26:16 +0000 (+0200) Subject: removed duplicate code X-Git-Tag: 4.1.1.0~106 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ec7383f34bac8e493eb6c68813c1affb1149890e;p=rocksndiamonds.git removed duplicate code --- diff --git a/src/game.c b/src/game.c index ca13127d..5a97b201 100644 --- a/src/game.c +++ b/src/game.c @@ -4650,7 +4650,7 @@ void GameWon() void GameEnd() { int hi_pos; - boolean raise_level = FALSE; + int last_level_nr = level_nr; local_player->LevelSolved_GameEnd = TRUE; @@ -4693,30 +4693,23 @@ void GameEnd() if (setup.increment_levels && level_nr < leveldir_current->last_level) - raise_level = TRUE; /* advance to next level */ + { + level_nr++; /* advance to next level */ + TapeErase(); /* start with empty tape */ + } + + hi_pos = NewHiScore(last_level_nr); - if ((hi_pos = NewHiScore(level_nr)) >= 0) + if (hi_pos >= 0) { SetGameStatus(GAME_MODE_SCORES); - DrawHallOfFame(level_nr, hi_pos); - - if (raise_level) - { - level_nr++; - TapeErase(); - } + DrawHallOfFame(last_level_nr, hi_pos); } else { SetGameStatus(GAME_MODE_MAIN); - if (raise_level) - { - level_nr++; - TapeErase(); - } - DrawMainMenu(); } } diff --git a/src/screens.c b/src/screens.c index 0198a8ee..1318bde1 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4619,17 +4619,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) drawHallOfFameList(first_entry, highlight_position); } } - else if (button == MB_MENU_LEAVE) - { - PlaySound(SND_MENU_ITEM_SELECTING); - - FadeSound(SND_BACKGROUND_SCORES); - - SetGameStatus(GAME_MODE_MAIN); - - DrawMainMenu(); - } - else if (button == MB_MENU_CHOICE) + else if (button == MB_MENU_LEAVE || button == MB_MENU_CHOICE) { PlaySound(SND_MENU_ITEM_SELECTING);