X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame.c;h=6d536ec61824da1b027d525fa4620b2cc341e2d5;hp=0c369f03ae7363a53b4b83d59ae75d2449e7a08b;hb=2443a8a09966a9940e1420c91d24a297325c2a00;hpb=335f4db8f7a8bea9b06eeea911b6d1e1d4de4623 diff --git a/src/game.c b/src/game.c index 0c369f03..6d536ec6 100644 --- a/src/game.c +++ b/src/game.c @@ -6305,6 +6305,31 @@ void RaiseScoreElement(int element) } } +void RequestQuitGame() +{ + if (AllPlayersGone || + !setup.ask_on_escape || + level_editor_test_game || + Request("Do you really want to quit the game ?", + REQ_ASK | REQ_STAY_CLOSED)) + { +#if defined(PLATFORM_UNIX) + if (options.network) + SendToServer_StopPlaying(); + else +#endif + { + game_status = MAINMENU; + DrawMainMenu(); + } + } + else + { + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); + } +} + + /* ---------- new game button stuff ---------------------------------------- */ /* graphic position values for game buttons */ @@ -6453,30 +6478,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) switch (id) { case GAME_CTRL_ID_STOP: - if (AllPlayersGone) - { - CloseDoor(DOOR_CLOSE_1); - game_status = MAINMENU; - DrawMainMenu(); - break; - } - - if (level_editor_test_game || - Request("Do you really want to quit the game ?", - REQ_ASK | REQ_STAY_CLOSED)) - { -#if defined(PLATFORM_UNIX) - if (options.network) - SendToServer_StopPlaying(); - else -#endif - { - game_status = MAINMENU; - DrawMainMenu(); - } - } - else - OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); + RequestQuitGame(); break; case GAME_CTRL_ID_PAUSE: