From: Holger Schemel Date: Fri, 19 Feb 2021 01:49:37 +0000 (+0100) Subject: added setup options to disable asking on quit game and on quit program X-Git-Tag: 4.2.3.0~2 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=94a1798d87daf68e97fa0968f7b08109868020ab;p=rocksndiamonds.git added setup options to disable asking on quit game and on quit program --- diff --git a/src/files.c b/src/files.c index 5cca0e30..6c26bb01 100644 --- a/src/files.c +++ b/src/files.c @@ -8604,6 +8604,14 @@ static struct TokenInfo global_setup_tokens[] = TYPE_SWITCH, &setup.ask_on_game_over, "ask_on_game_over" }, + { + TYPE_SWITCH, + &setup.ask_on_quit_game, "ask_on_quit_game" + }, + { + TYPE_SWITCH, + &setup.ask_on_quit_program, "ask_on_quit_program" + }, { TYPE_SWITCH, &setup.quick_switch, "quick_player_switch" @@ -9296,6 +9304,8 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->ask_on_escape = TRUE; si->ask_on_escape_editor = TRUE; si->ask_on_game_over = TRUE; + si->ask_on_quit_game = TRUE; + si->ask_on_quit_program = TRUE; si->quick_switch = FALSE; si->input_on_focus = FALSE; si->prefer_aga_graphics = TRUE; diff --git a/src/game.c b/src/game.c index 476b67b0..07df1fe5 100644 --- a/src/game.c +++ b/src/game.c @@ -15373,12 +15373,12 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message) { if (skip_request || Request(message, REQ_ASK | REQ_STAY_CLOSED)) { - // closing door required in case of envelope style request dialogs - if (!skip_request) + if (!quick_quit) { // prevent short reactivation of overlay buttons while closing door SetOverlayActive(FALSE); + // door may still be open due to skipped or envelope style request CloseDoor(DOOR_CLOSE_1); } @@ -15408,9 +15408,11 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message) void RequestQuitGame(boolean escape_key_pressed) { - boolean quick_quit = ((escape_key_pressed && !setup.ask_on_escape) || + boolean ask_on_escape = (setup.ask_on_escape && setup.ask_on_quit_game); + boolean quick_quit = ((escape_key_pressed && !ask_on_escape) || level_editor_test_game); - boolean skip_request = game.all_players_gone || quick_quit; + boolean skip_request = (game.all_players_gone || !setup.ask_on_quit_game || + quick_quit); RequestQuitGameExt(skip_request, quick_quit, "Do you really want to quit the game?"); diff --git a/src/libgame/system.h b/src/libgame/system.h index 8ebd43dc..ca8494bc 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1461,6 +1461,8 @@ struct SetupInfo boolean ask_on_escape; boolean ask_on_escape_editor; boolean ask_on_game_over; + boolean ask_on_quit_game; + boolean ask_on_quit_program; boolean quick_switch; boolean input_on_focus; boolean prefer_aga_graphics; diff --git a/src/screens.c b/src/screens.c index e9eaf40f..c82f2a96 100644 --- a/src/screens.c +++ b/src/screens.c @@ -2223,7 +2223,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) SaveLevelSetup_LastSeries(); SaveLevelSetup_SeriesInfo(); - if (Request("Do you really want to quit?", REQ_ASK | REQ_STAY_CLOSED)) + if (!setup.ask_on_quit_program || + Request("Do you really want to quit?", REQ_ASK | REQ_STAY_CLOSED)) SetGameStatus(GAME_MODE_QUIT); } } @@ -6732,6 +6733,8 @@ static struct TokenInfo setup_info_game[] = { TYPE_SWITCH, &setup.count_score_after_game,"Count Score After Game:" }, { TYPE_SWITCH, &setup.show_scores_after_game,"Show Scores After Game:" }, { TYPE_YES_NO, &setup.ask_on_game_over, "Ask on Game Over:" }, + { TYPE_YES_NO, &setup.ask_on_quit_game, "Ask on Quit Game:" }, + { TYPE_YES_NO, &setup.ask_on_quit_program, "Ask on Quit Program:" }, { TYPE_SWITCH, &setup.autorecord, "Auto-Record Tapes:" }, { TYPE_ENTER_LIST, execSetupChooseGameSpeed, "Game Speed:" }, { TYPE_STRING, &game_speed_text, "" },