From d26252c883d72254c636a57e72cb55d533a453f2 Mon Sep 17 00:00:00 2001 From: Matt <5415177+ZehMatt@users.noreply.github.com> Date: Mon, 11 Aug 2025 23:51:39 +0300 Subject: [PATCH] Index and load objects after the editor scene is initialized not before (#24953) * Index and load objects after the editor scene is initialized not before * Remove pointless calls and cleanup * Display the progress window when loading the editor * Update changelog.txt --- distribution/changelog.txt | 2 ++ src/openrct2/Editor.cpp | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index bbf383611d..e2e1f8b050 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -3,9 +3,11 @@ - Improved: [#24734] Save files now use Zstd compression for faster saving and smaller files. - Improved: [#24893] The ride list now has headers, and can be sorted in both directions. - Improved: [#24921] The command line sprite build command now prints out the images table entry for the compiled sprite file. +- Improved: [#24953] Opening the Scenario Editor, Track Designer or Track Designs Manager now display the progress bar. - Fix: [#16988] AppImage version does not show changelog. - Fix: [#24173] Allow all game speeds between 1 and 8 if developer mode is on. - Fix: [#24915] LIM Launched (original bug), Corkscrew and Twister Roller Coaster inline twists have some incorrect tunnels. +- Fix: [#24953] Crash when opening the Scenario Editor, Track Designer or Track Designs Manager. 0.4.25 (2025-08-03) ------------------------------------------------------------------------ diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index ea06a3201a..e57895caaf 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -65,6 +65,7 @@ namespace OpenRCT2::Editor static void ObjectListLoad() { auto* context = GetContext(); + context->OpenProgress(STR_LOADING_GENERIC); // Unload objects first, the repository is re-populated which owns the objects. auto& objectManager = context->GetObjectManager(); @@ -83,6 +84,8 @@ namespace OpenRCT2::Editor { objectManager.LoadObject(entry); } + + context->CloseProgress(); } static WindowBase* OpenEditorWindows() @@ -105,12 +108,12 @@ namespace OpenRCT2::Editor auto& gameState = getGameState(); Audio::StopAll(); - ObjectListLoad(); gameStateInitAll(gameState, kDefaultMapSize); gLegacyScene = LegacyScene::scenarioEditor; gameState.editorStep = EditorStep::ObjectSelection; gameState.park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gameState.scenarioCategory = ScenarioCategory::other; + ObjectListLoad(); ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); mainWindow->SetViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); @@ -183,11 +186,11 @@ namespace OpenRCT2::Editor gLegacyScene = LegacyScene::trackDesigner; gScreenAge = 0; - ObjectManagerUnloadAllObjects(); - ObjectListLoad(); - gameStateInitAll(getGameState(), kDefaultMapSize); + auto& gameState = getGameState(); + gameStateInitAll(gameState, kDefaultMapSize); + gameState.editorStep = EditorStep::ObjectSelection; SetAllLandOwned(); - getGameState().editorStep = EditorStep::ObjectSelection; + ObjectListLoad(); ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); mainWindow->SetViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); @@ -211,11 +214,11 @@ namespace OpenRCT2::Editor gLegacyScene = LegacyScene::trackDesignsManager; gScreenAge = 0; - ObjectManagerUnloadAllObjects(); - ObjectListLoad(); - gameStateInitAll(getGameState(), kDefaultMapSize); + auto& gameState = getGameState(); + gameStateInitAll(gameState, kDefaultMapSize); SetAllLandOwned(); - getGameState().editorStep = EditorStep::ObjectSelection; + gameState.editorStep = EditorStep::ObjectSelection; + ObjectListLoad(); ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); mainWindow->SetViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());