From 1fde5e53f9cdda2ef0496e0f005c8395d8f4c903 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Tue, 9 Jun 2015 19:05:59 +0100 Subject: [PATCH] Change order of load_save code This prevents the window from appearing for a millisecond when you press x. Fixes #1264 --- src/windows/save_prompt.c | 51 ++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/windows/save_prompt.c b/src/windows/save_prompt.c index be2349cc90..61f5f40419 100644 --- a/src/windows/save_prompt.c +++ b/src/windows/save_prompt.c @@ -127,6 +127,32 @@ void window_save_prompt_open() return; } + if (!gConfigGeneral.confirmation_prompt) { + /* game_load_or_quit_no_save_prompt() will exec requested task and close this window + * immediately again. + * TODO restructure these functions when we're sure game_load_or_quit_no_save_prompt() + * and game_load_or_quit() are not called by the original binary anymore. + */ + + if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 0) { + if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 1) { + RCT2_CALLPROC_EBPSAFE(0x0066EE54); + game_load_or_quit_no_save_prompt(); + return; + } + else { + tutorial_stop(); + game_load_or_quit_no_save_prompt(); + return; + } + } + + if (RCT2_GLOBAL(0x009DEA66, uint16) < 3840) { + game_load_or_quit_no_save_prompt(); + return; + } + } + // Check if window is already open window = window_bring_to_front_by_class(WC_SAVE_PROMPT); if (window){ @@ -176,31 +202,6 @@ void window_save_prompt_open() stringId = STR_QUIT_SCENARIO_EDITOR; window_save_prompt_widgets[WIDX_TITLE].image = stringId; window_save_prompt_widgets[WIDX_LABEL].image = prompt_mode + STR_SAVE_BEFORE_LOADING; - - if (!gConfigGeneral.confirmation_prompt) { - /* game_load_or_quit_no_save_prompt() will exec requested task and close this window - * immediately again. - * TODO restructure these functions when we're sure game_load_or_quit_no_save_prompt() - * and game_load_or_quit() are not called by the original binary anymore. - */ - - if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 0) { - if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 1) { - RCT2_CALLPROC_EBPSAFE(0x0066EE54); - game_load_or_quit_no_save_prompt(); - return; - } else { - tutorial_stop(); - game_load_or_quit_no_save_prompt(); - return; - } - } - - if (RCT2_GLOBAL(0x009DEA66, uint16) < 3840) { - game_load_or_quit_no_save_prompt(); - return; - } - } } /**