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.
This commit is contained in:
Severin Paul Höfer authored and GitHub committed 2024-01-15 08:26:58 +01:00
1 parent 739dd712d5
commit 62d0fd76e0
2 files changed
+17 -17

No files matched your search

+1
View File
@@ -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.
+16 -17
View File
@@ -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