removed duplicate code
authorHolger Schemel <info@artsoft.org>
Thu, 21 Jun 2018 06:26:16 +0000 (08:26 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 21 Jun 2018 06:32:58 +0000 (08:32 +0200)
src/game.c
src/screens.c

index ca13127d2e7a5866aef72e02591ed0b87daa459a..5a97b201b510b71676ae0f3a64253e5d8a5098ba 100644 (file)
@@ -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();
   }
 }
index 0198a8eea8bdb8e5a472e84b0cd96c67a4d10e9c..1318bde16e80a2a079b41caab99c452ef8714d78 100644 (file)
@@ -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);