From 3d67fd730d6d47134bda0210d2b51090652d7dc8 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 9 Jul 2024 02:27:47 +0200 Subject: [PATCH] Run QuitGame instead of DoSaveGame when quitting a game after pressing CTRL+Q (#388) --- src/DETHRACE/common/utility.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/DETHRACE/common/utility.c b/src/DETHRACE/common/utility.c index 1a172d37..9e53c257 100644 --- a/src/DETHRACE/common/utility.c +++ b/src/DETHRACE/common/utility.c @@ -12,6 +12,7 @@ #include "input.h" #include "loading.h" #include "loadsave.h" +#include "main.h" #include "mainmenu.h" #include "network.h" #include "pd/sys.h" @@ -44,18 +45,22 @@ br_pixelmap* gSource_for_16bit_palette; int CheckQuit(void) { LOG_TRACE8("()"); - if (!gIn_check_quit && KeyIsDown(KEYMAP_CTRL_QUIT) && KeyIsDown(KEYMAP_CONTROL_ANY)) { - gIn_check_quit = 1; - while (AnyKeyDown()) { - ; - } + if (gIn_check_quit) { + return 0; + } + if (!KeyIsDown(KEYMAP_CTRL_QUIT) || !KeyIsDown(KEYMAP_CONTROL_ANY)) { + return 0; + } + gIn_check_quit = 1; + while (AnyKeyDown()) { + ; + } - if (DoVerifyQuit(1)) { - DoSaveGame(1); - } - gIn_check_quit = 0; + if (DoVerifyQuit(1)) { + QuitGame(); } - return 0; + gIn_check_quit = 0; + return 1; } // IDA: double __cdecl sqr(double pN)