From a4e92770fd83fbbd1121d6942cd37d4ca7e8cde0 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Wed, 28 May 2025 00:58:25 +0200 Subject: [PATCH] Defer temp object Load/Unload to calling side --- src/openrct2-ui/windows/ScenarioSelect.cpp | 2 +- src/openrct2/object/ObjectManager.cpp | 2 -- src/openrct2/rct1/S4Importer.cpp | 2 -- src/openrct2/rct2/S6Importer.cpp | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index f30d0b7508..28daa2c346 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -243,10 +243,10 @@ namespace OpenRCT2::Ui::Windows return; auto& objManager = GetContext()->GetObjectManager(); - if (auto obj = objManager.LoadTempObject(source.textObjectId); obj != nullptr) { auto& scenarioMetaObj = reinterpret_cast(*obj); + scenarioMetaObj.Load(); ParkPreview preview{}; preview.images.push_back(scenarioMetaObj.GetMiniMapImage()); diff --git a/src/openrct2/object/ObjectManager.cpp b/src/openrct2/object/ObjectManager.cpp index 4ead4a1152..582b812968 100644 --- a/src/openrct2/object/ObjectManager.cpp +++ b/src/openrct2/object/ObjectManager.cpp @@ -173,8 +173,6 @@ public: } auto object = _objectRepository.LoadObject(ori); - object->Load(); - return object; } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 1d9070048c..16489a0740 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -276,8 +276,6 @@ namespace OpenRCT2::RCT1 auto& textObject = reinterpret_cast(*obj); name = textObject.GetScenarioName(); details = textObject.GetScenarioDetails(); - - obj->Unload(); } } diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index e94bda7f72..7e15dcc24f 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -301,8 +301,6 @@ namespace OpenRCT2::RCT2 auto& textObject = reinterpret_cast(*obj); dst->Name = textObject.GetScenarioName(); dst->Details = textObject.GetScenarioDetails(); - - obj->Unload(); } }