From 62d0fd76e05ea668ce7c1c7cb51df5407bd7cee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Severin=20Paul=20H=C3=B6fer?= <84280965+zzril@users.noreply.github.com> Date: Mon, 15 Jan 2024 08:26:58 +0100 Subject: [PATCH] Fix #20616: Confirmation button in track designer's quit prompt has the wrong text Wrapped the logic for determining the text to be displayed on title and buttons of the save prompt in an if condition, so it's not run for the pure quit prompt. --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/SavePrompt.cpp | 33 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 9ed2d927c2..b86f0b5a7b 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -2,6 +2,7 @@ ------------------------------------------------------------------------ - Improved: [#18632] Land ownership and construction rights are now shown on top of the water. - Improved: [#20951] Activate OpenRCT2 window after using native file dialog on macOS. +- Fix: [#20616] Confirmation button in the track designer’s quit prompt has the wrong text. - Fix: [#21145] [Plugin] setInterval/setTimeout handle conflict. - Fix: [#21158] [Plugin] Potential crash using setInterval/setTimeout within the callback. - Fix: [#21171] [Plugin] Crash creating entities with no more entity slots available. diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 1182bd8674..e5c3c645d4 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -89,14 +89,10 @@ public: void OnOpen() override { - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) - { - widgets = _quitPromptWidgets; - } - else - { - widgets = _savePromptWidgets; - } + bool canSave = !(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)); + + widgets = canSave ? _savePromptWidgets : _quitPromptWidgets; + InitScrollWidgets(); // Pause the game if not network play. @@ -108,17 +104,20 @@ public: WindowInvalidateByClass(WindowClass::TopToolbar); - StringId stringId = window_save_prompt_labels[EnumValue(_promptMode)][0]; - if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (canSave) { - stringId = STR_LOAD_LANDSCAPE_PROMPT_TITLE; + StringId stringId = window_save_prompt_labels[EnumValue(_promptMode)][0]; + if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + { + stringId = STR_LOAD_LANDSCAPE_PROMPT_TITLE; + } + else if (stringId == STR_QUIT_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + { + stringId = STR_QUIT_SCENARIO_EDITOR; + } + widgets[WIDX_TITLE].text = stringId; + widgets[WIDX_LABEL].text = window_save_prompt_labels[EnumValue(_promptMode)][1]; } - else if (stringId == STR_QUIT_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) - { - stringId = STR_QUIT_SCENARIO_EDITOR; - } - widgets[WIDX_TITLE].text = stringId; - widgets[WIDX_LABEL].text = window_save_prompt_labels[EnumValue(_promptMode)][1]; } void OnClose() override