From 0d6ed8efc5dc835e9e31ecb94ff74279b974f338 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Fri, 18 Oct 2024 09:14:50 +0200 Subject: [PATCH] Close windows before loading another save --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/LoadSave.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index c0ffacf556..c2653a3a21 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -7,6 +7,7 @@ - Fix: [#22921] Wooden RollerCoaster flat to steep railings appear in front of track in front of them. - Fix: [#22962] Fuzzy horizontal-to-vertical line transitions in charts. - Fix: [#23009] Scenarios from RCT Classic (.sea files) are not included in the scenario index. +- Fix: [#23015] Crash when loading a save game when the construction window is still open. 0.4.15 (2024-10-06) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 58b7ec134c..c15424d652 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -267,6 +267,11 @@ namespace OpenRCT2::Ui::Windows char pathBuffer[MAX_PATH]; SafeStrCpy(pathBuffer, path, sizeof(pathBuffer)); + // Closing this will cause a Ride window to pop up, so we have to do this to ensure that + // no windows are open (besides the toolbars and LoadSave window). + WindowCloseByClass(WindowClass::RideConstruction); + WindowCloseAllExceptClass(WindowClass::Loadsave); + auto& gameState = GetGameState(); switch (_type & 0x0F)