From c5d53759f2deb00fe18691a762d5812888a00f17 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Fri, 6 Dec 2024 17:30:25 +0000 Subject: [PATCH 1/3] Add debug option to skip the y/n prompts for quitting --- src/game.cpp | 3 ++- src/handle_action.cpp | 2 +- src/main_menu.cpp | 2 +- src/options.cpp | 5 +++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 15294483e9606..cc8ed5d8cbf3a 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2855,7 +2855,8 @@ bool game::query_exit_to_OS() const int old_timeout = inp_mngr.get_timeout(); inp_mngr.reset_timeout(); uquit = QUIT_EXIT_PENDING; // change it before query so input_context doesn't get confused - if( query_yn( _( "Really Quit? All unsaved changes will be lost." ) ) ) { + if( !get_option( "QUERY_ON_QUIT" ) || + query_yn( _( "Really Quit? All unsaved changes will be lost." ) ) ) { uquit = QUIT_EXIT; throw exit_exception(); } diff --git a/src/handle_action.cpp b/src/handle_action.cpp index 8fab8fda01fda..0ee5454a46b24 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -2820,7 +2820,7 @@ bool game::do_regular_action( action_id &act, avatar &player_character, break; case ACTION_SAVE: - if( query_yn( _( "Save and quit?" ) ) ) { + if( !get_option( "QUERY_ON_QUIT" ) || query_yn( _( "Save and quit?" ) ) ) { if( save() ) { player_character.set_moves( 0 ); uquit = QUIT_SAVED; diff --git a/src/main_menu.cpp b/src/main_menu.cpp index 9a2ae6a275c5c..494dacb51de97 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -885,7 +885,7 @@ bool main_menu::opening_screen() if( action == "QUIT" ) { #if !defined(EMSCRIPTEN) g->uquit = QUIT_EXIT_PENDING; - if( query_yn( _( "Really quit?" ) ) ) { + if( !get_option( "QUERY_ON_QUIT" ) || query_yn( _( "Really quit?" ) ) ) { g->uquit = QUIT_EXIT; return false; } diff --git a/src/options.cpp b/src/options.cpp index f7223dbeac0be..068925a3a530f 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -2972,6 +2972,11 @@ void options_manager::add_options_debug() false #endif ); + + add( "QUERY_ON_QUIT", "debug", to_translation( "Prompt when trying to quit the game" ), + to_translation( "If enabled, this shows a yes/no prompt before quitting the game." ), + true + ); } void options_manager::add_options_android() From 798244d90127eb97889518817c79caab3817103e Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Fri, 6 Dec 2024 18:15:51 +0000 Subject: [PATCH 2/3] Move option --- src/game.cpp | 2 +- src/handle_action.cpp | 2 +- src/main_menu.cpp | 2 +- src/options.cpp | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index cc8ed5d8cbf3a..58215cbada254 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2855,7 +2855,7 @@ bool game::query_exit_to_OS() const int old_timeout = inp_mngr.get_timeout(); inp_mngr.reset_timeout(); uquit = QUIT_EXIT_PENDING; // change it before query so input_context doesn't get confused - if( !get_option( "QUERY_ON_QUIT" ) || + if( !get_option( "QUERY_QUIT" ) || query_yn( _( "Really Quit? All unsaved changes will be lost." ) ) ) { uquit = QUIT_EXIT; throw exit_exception(); diff --git a/src/handle_action.cpp b/src/handle_action.cpp index 0ee5454a46b24..a2547b4f6806a 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -2820,7 +2820,7 @@ bool game::do_regular_action( action_id &act, avatar &player_character, break; case ACTION_SAVE: - if( !get_option( "QUERY_ON_QUIT" ) || query_yn( _( "Save and quit?" ) ) ) { + if( !get_option( "QUERY_QUIT" ) || query_yn( _( "Save and quit?" ) ) ) { if( save() ) { player_character.set_moves( 0 ); uquit = QUIT_SAVED; diff --git a/src/main_menu.cpp b/src/main_menu.cpp index 494dacb51de97..e0598e5f96f7d 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -885,7 +885,7 @@ bool main_menu::opening_screen() if( action == "QUIT" ) { #if !defined(EMSCRIPTEN) g->uquit = QUIT_EXIT_PENDING; - if( !get_option( "QUERY_ON_QUIT" ) || query_yn( _( "Really quit?" ) ) ) { + if( !get_option( "QUERY_QUIT" ) || query_yn( _( "Really quit?" ) ) ) { g->uquit = QUIT_EXIT; return false; } diff --git a/src/options.cpp b/src/options.cpp index 068925a3a530f..cd1a62803f59d 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1926,6 +1926,11 @@ void options_manager::add_options_interface() true ); + add( "QUERY_QUIT", page_id, to_translation( "Query on quit" ), + to_translation( "If true, will query before before quitting the game." ), + true + ); + add( "CLOSE_ADV_INV", page_id, to_translation( "Close advanced inventory on move all" ), to_translation( "If true, will close the advanced inventory when the move all items command is used." ), false @@ -2972,11 +2977,6 @@ void options_manager::add_options_debug() false #endif ); - - add( "QUERY_ON_QUIT", "debug", to_translation( "Prompt when trying to quit the game" ), - to_translation( "If enabled, this shows a yes/no prompt before quitting the game." ), - true - ); } void options_manager::add_options_android() From f464be91fd1f63cb02896971ac6e59633ce385da Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:28:19 +0000 Subject: [PATCH 3/3] Remove quit query option and remove queries from menu and save quitting --- src/game.cpp | 3 +-- src/handle_action.cpp | 8 +++----- src/main_menu.cpp | 8 ++------ src/options.cpp | 5 ----- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 58215cbada254..15294483e9606 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2855,8 +2855,7 @@ bool game::query_exit_to_OS() const int old_timeout = inp_mngr.get_timeout(); inp_mngr.reset_timeout(); uquit = QUIT_EXIT_PENDING; // change it before query so input_context doesn't get confused - if( !get_option( "QUERY_QUIT" ) || - query_yn( _( "Really Quit? All unsaved changes will be lost." ) ) ) { + if( query_yn( _( "Really Quit? All unsaved changes will be lost." ) ) ) { uquit = QUIT_EXIT; throw exit_exception(); } diff --git a/src/handle_action.cpp b/src/handle_action.cpp index a2547b4f6806a..b2ab51cab0221 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -2820,11 +2820,9 @@ bool game::do_regular_action( action_id &act, avatar &player_character, break; case ACTION_SAVE: - if( !get_option( "QUERY_QUIT" ) || query_yn( _( "Save and quit?" ) ) ) { - if( save() ) { - player_character.set_moves( 0 ); - uquit = QUIT_SAVED; - } + if( save() ) { + player_character.set_moves( 0 ); + uquit = QUIT_SAVED; } break; diff --git a/src/main_menu.cpp b/src/main_menu.cpp index e0598e5f96f7d..c079293739e59 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -884,12 +884,8 @@ bool main_menu::opening_screen() // also check special keys if( action == "QUIT" ) { #if !defined(EMSCRIPTEN) - g->uquit = QUIT_EXIT_PENDING; - if( !get_option( "QUERY_QUIT" ) || query_yn( _( "Really quit?" ) ) ) { - g->uquit = QUIT_EXIT; - return false; - } - g->uquit = QUIT_NO; + g->uquit = QUIT_EXIT; + return false; #endif } else if( action == "LEFT" || action == "PREV_TAB" || action == "RIGHT" || action == "NEXT_TAB" ) { sel_line = 0; diff --git a/src/options.cpp b/src/options.cpp index cd1a62803f59d..f7223dbeac0be 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1926,11 +1926,6 @@ void options_manager::add_options_interface() true ); - add( "QUERY_QUIT", page_id, to_translation( "Query on quit" ), - to_translation( "If true, will query before before quitting the game." ), - true - ); - add( "CLOSE_ADV_INV", page_id, to_translation( "Close advanced inventory on move all" ), to_translation( "If true, will close the advanced inventory when the move all items command is used." ), false