X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=b7f8736a03a77ec1d932b44956ca14d871242477;hb=7f44b998d7a52222429d0794d3ec1713f37a7f47;hp=d91d8ac3ec629de5625ce29485531dba7c64bfa9;hpb=091fb8657b4a793fb753c58fff21dbd2458c419f;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index d91d8ac3..b7f8736a 100644 --- a/src/game.c +++ b/src/game.c @@ -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,13 +15695,24 @@ void CheckGameOver(void) game_over_delay--; - return; + return FALSE; } - if (last_game_over != game_over) - game.restart_game_message = getRestartGameMessage(); + // 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 FALSE; + + RequestRestartGame(getRestartGameMessage()); - last_game_over = game_over; + return TRUE; } boolean checkGameSolved(void)