removed variable that was not required
[rocksndiamonds.git] / src / game.c
index 1cbea93f65185b803d2d0c6087be03a9227e3c9b..b7f8736a03a77ec1d932b44956ca14d871242477 100644 (file)
@@ -4515,7 +4515,6 @@ void InitGame(void)
   }
 
   game.restart_level = FALSE;
-  game.restart_game_message = NULL;
 
   game.request_active = FALSE;
   game.request_active_or_moving = FALSE;
@@ -15635,8 +15634,6 @@ void RequestQuitGame(boolean escape_key_pressed)
 
 void RequestRestartGame(char *message)
 {
-  game.restart_game_message = NULL;
-
   boolean has_started_game = hasStartedNetworkGame();
   int request_mode = (has_started_game ? REQ_ASK : REQ_CONFIRM);
   int door_state = DOOR_CLOSE_1;
@@ -15678,27 +15675,17 @@ static char *getRestartGameMessage(void)
   return message;
 }
 
-void CheckGameOver(void)
+boolean CheckRestartGame(void)
 {
-  static boolean last_game_over = FALSE;
   static int game_over_delay = 0;
   int game_over_delay_value = 50;
   boolean game_over = checkGameFailed();
 
-  // do not handle game over if request dialog is already active
-  if (game.request_active)
-    return;
-
-  // do not ask to play again if game was never actually played
-  if (!game.GamePlayed)
-    return;
-
   if (!game_over)
   {
-    last_game_over = FALSE;
     game_over_delay = game_over_delay_value;
 
-    return;
+    return FALSE;
   }
 
   if (game_over_delay > 0)
@@ -15708,17 +15695,24 @@ void CheckGameOver(void)
 
     game_over_delay--;
 
-    return;
+    return FALSE;
   }
 
+  // do not handle game over if request dialog is already active
+  if (game.request_active)
+    return FALSE;
+
+  // do not ask to play again if game was never actually played
+  if (!game.GamePlayed)
+    return FALSE;
+
   // do not ask to play again if this was disabled in setup menu
   if (!setup.ask_on_game_over)
-    return;
+    return FALSE;
 
-  if (last_game_over != game_over)
-    game.restart_game_message = getRestartGameMessage();
+  RequestRestartGame(getRestartGameMessage());
 
-  last_game_over = game_over;
+  return TRUE;
 }
 
 boolean checkGameSolved(void)