From 4c9a84777f762b120d1b05d46fd4f0c6598f3fb9 Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 19 Oct 2024 12:07:12 +0200 Subject: [PATCH] chore: use IObjLoader directly instead of indirection of ObjLoading --- src/Linker/Game/IW3/ZoneCreatorIW3.cpp | 6 ++- src/Linker/Game/IW4/ZoneCreatorIW4.cpp | 6 ++- src/Linker/Game/IW5/ZoneCreatorIW5.cpp | 6 ++- src/Linker/Game/T5/ZoneCreatorT5.cpp | 6 ++- src/Linker/Game/T6/ZoneCreatorT6.cpp | 6 ++- src/Linker/ZoneCreation/ZoneCreator.cpp | 1 + src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp | 5 -- src/ObjLoading/Game/IW3/ObjLoaderIW3.h | 2 - src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp | 5 -- src/ObjLoading/Game/IW4/ObjLoaderIW4.h | 2 - src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp | 5 -- src/ObjLoading/Game/IW5/ObjLoaderIW5.h | 2 - src/ObjLoading/Game/T5/ObjLoaderT5.cpp | 5 -- src/ObjLoading/Game/T5/ObjLoaderT5.h | 2 - src/ObjLoading/Game/T6/ObjLoaderT6.cpp | 5 -- src/ObjLoading/Game/T6/ObjLoaderT6.h | 2 - src/ObjLoading/IObjLoader.cpp | 27 +++++++++++ src/ObjLoading/IObjLoader.h | 9 +--- src/ObjLoading/ObjLoading.cpp | 62 ------------------------ src/ObjLoading/ObjLoading.h | 18 ------- src/Unlinker/Unlinker.cpp | 16 ++++-- 21 files changed, 62 insertions(+), 136 deletions(-) create mode 100644 src/ObjLoading/IObjLoader.cpp diff --git a/src/Linker/Game/IW3/ZoneCreatorIW3.cpp b/src/Linker/Game/IW3/ZoneCreatorIW3.cpp index 280d32b5..a512f1eb 100644 --- a/src/Linker/Game/IW3/ZoneCreatorIW3.cpp +++ b/src/Linker/Game/IW3/ZoneCreatorIW3.cpp @@ -3,6 +3,7 @@ #include "AssetLoading/AssetLoadingContext.h" #include "Game/IW3/GameAssetPoolIW3.h" #include "Game/IW3/GameIW3.h" +#include "IObjLoader.h" #include "ObjLoading.h" #include "Utils/StringUtils.h" @@ -53,13 +54,14 @@ std::unique_ptr ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& const auto assetLoadingContext = std::make_unique(*zone, *context.m_asset_search_path, CreateGdtList(context)); ApplyIgnoredAssets(context, *assetLoadingContext); + const auto* objLoader = IObjLoader::GetObjLoaderForGame(GameId::IW3); for (const auto& assetEntry : context.m_definition->m_assets) { - if (!ObjLoading::LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) + if (!objLoader->LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) return nullptr; } - ObjLoading::FinalizeAssetsForZone(*assetLoadingContext); + objLoader->FinalizeAssetsForZone(*assetLoadingContext); return zone; } diff --git a/src/Linker/Game/IW4/ZoneCreatorIW4.cpp b/src/Linker/Game/IW4/ZoneCreatorIW4.cpp index 937b9680..34c01b14 100644 --- a/src/Linker/Game/IW4/ZoneCreatorIW4.cpp +++ b/src/Linker/Game/IW4/ZoneCreatorIW4.cpp @@ -2,6 +2,7 @@ #include "Game/IW4/GameAssetPoolIW4.h" #include "Game/IW4/GameIW4.h" +#include "IObjLoader.h" #include "ObjLoading.h" #include "Utils/StringUtils.h" @@ -52,13 +53,14 @@ std::unique_ptr ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& const auto assetLoadingContext = std::make_unique(*zone, *context.m_asset_search_path, CreateGdtList(context)); ApplyIgnoredAssets(context, *assetLoadingContext); + const auto* objLoader = IObjLoader::GetObjLoaderForGame(GameId::IW4); for (const auto& assetEntry : context.m_definition->m_assets) { - if (!ObjLoading::LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) + if (!objLoader->LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) return nullptr; } - ObjLoading::FinalizeAssetsForZone(*assetLoadingContext); + objLoader->FinalizeAssetsForZone(*assetLoadingContext); return zone; } diff --git a/src/Linker/Game/IW5/ZoneCreatorIW5.cpp b/src/Linker/Game/IW5/ZoneCreatorIW5.cpp index 6f9b913c..83023066 100644 --- a/src/Linker/Game/IW5/ZoneCreatorIW5.cpp +++ b/src/Linker/Game/IW5/ZoneCreatorIW5.cpp @@ -2,6 +2,7 @@ #include "Game/IW5/GameAssetPoolIW5.h" #include "Game/IW5/GameIW5.h" +#include "IObjLoader.h" #include "ObjLoading.h" #include "Utils/StringUtils.h" @@ -52,13 +53,14 @@ std::unique_ptr ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& const auto assetLoadingContext = std::make_unique(*zone, *context.m_asset_search_path, CreateGdtList(context)); ApplyIgnoredAssets(context, *assetLoadingContext); + const auto* objLoader = IObjLoader::GetObjLoaderForGame(GameId::IW5); for (const auto& assetEntry : context.m_definition->m_assets) { - if (!ObjLoading::LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) + if (!objLoader->LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) return nullptr; } - ObjLoading::FinalizeAssetsForZone(*assetLoadingContext); + objLoader->FinalizeAssetsForZone(*assetLoadingContext); return zone; } diff --git a/src/Linker/Game/T5/ZoneCreatorT5.cpp b/src/Linker/Game/T5/ZoneCreatorT5.cpp index d14e3510..58330267 100644 --- a/src/Linker/Game/T5/ZoneCreatorT5.cpp +++ b/src/Linker/Game/T5/ZoneCreatorT5.cpp @@ -3,6 +3,7 @@ #include "AssetLoading/AssetLoadingContext.h" #include "Game/T5/GameAssetPoolT5.h" #include "Game/T5/GameT5.h" +#include "IObjLoader.h" #include "ObjLoading.h" #include "Utils/StringUtils.h" @@ -53,13 +54,14 @@ std::unique_ptr ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& const auto assetLoadingContext = std::make_unique(*zone, *context.m_asset_search_path, CreateGdtList(context)); ApplyIgnoredAssets(context, *assetLoadingContext); + const auto* objLoader = IObjLoader::GetObjLoaderForGame(GameId::T5); for (const auto& assetEntry : context.m_definition->m_assets) { - if (!ObjLoading::LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) + if (!objLoader->LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) return nullptr; } - ObjLoading::FinalizeAssetsForZone(*assetLoadingContext); + objLoader->FinalizeAssetsForZone(*assetLoadingContext); return zone; } diff --git a/src/Linker/Game/T6/ZoneCreatorT6.cpp b/src/Linker/Game/T6/ZoneCreatorT6.cpp index c50b53fe..388ab962 100644 --- a/src/Linker/Game/T6/ZoneCreatorT6.cpp +++ b/src/Linker/Game/T6/ZoneCreatorT6.cpp @@ -4,6 +4,7 @@ #include "Game/T6/GameAssetPoolT6.h" #include "Game/T6/GameT6.h" #include "Game/T6/T6.h" +#include "IObjLoader.h" #include "ObjLoading.h" #include "Utils/StringUtils.h" @@ -106,13 +107,14 @@ std::unique_ptr ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& HandleMetadata(zone.get(), context); + const auto* objLoader = IObjLoader::GetObjLoaderForGame(GameId::T6); for (const auto& assetEntry : context.m_definition->m_assets) { - if (!ObjLoading::LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) + if (!objLoader->LoadAssetForZone(*assetLoadingContext, assetEntry.m_asset_type, assetEntry.m_asset_name)) return nullptr; } - ObjLoading::FinalizeAssetsForZone(*assetLoadingContext); + objLoader->FinalizeAssetsForZone(*assetLoadingContext); return zone; } diff --git a/src/Linker/ZoneCreation/ZoneCreator.cpp b/src/Linker/ZoneCreation/ZoneCreator.cpp index 7d8b4958..9e1f1004 100644 --- a/src/Linker/ZoneCreation/ZoneCreator.cpp +++ b/src/Linker/ZoneCreation/ZoneCreator.cpp @@ -1,5 +1,6 @@ #include "ZoneCreator.h" +#include "AssetLoading/AssetLoadingContext.h" #include "Game/IW3/ZoneCreatorIW3.h" #include "Game/IW4/ZoneCreatorIW4.h" #include "Game/IW5/ZoneCreatorIW5.h" diff --git a/src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp b/src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp index 9faea56b..4ea79be1 100644 --- a/src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp +++ b/src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp @@ -48,11 +48,6 @@ ObjLoader::ObjLoader() #undef REGISTER_ASSET_LOADER } -bool ObjLoader::SupportsZone(const Zone& zone) const -{ - return zone.m_game == &g_GameIW3; -} - bool ObjLoader::IsMpZone(const Zone& zone) { return zone.m_name.compare(0, 3, "mp_") == 0 || zone.m_name.compare(zone.m_name.length() - 3, 3, "_mp") == 0; diff --git a/src/ObjLoading/Game/IW3/ObjLoaderIW3.h b/src/ObjLoading/Game/IW3/ObjLoaderIW3.h index ec733cbe..f027ecb4 100644 --- a/src/ObjLoading/Game/IW3/ObjLoaderIW3.h +++ b/src/ObjLoading/Game/IW3/ObjLoaderIW3.h @@ -19,8 +19,6 @@ namespace IW3 public: ObjLoader(); - [[nodiscard]] bool SupportsZone(const Zone& zone) const override; - void LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone) const override; void UnloadContainersOfZone(Zone& zone) const override; diff --git a/src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp b/src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp index c055156e..0960b737 100644 --- a/src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp +++ b/src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp @@ -92,11 +92,6 @@ ObjLoader::ObjLoader() #undef REGISTER_ASSET_LOADER } -bool ObjLoader::SupportsZone(const Zone& zone) const -{ - return zone.m_game == &g_GameIW4; -} - bool ObjLoader::IsMpZone(const Zone& zone) { return zone.m_name.compare(0, 3, "mp_") == 0 || zone.m_name.compare(zone.m_name.length() - 3, 3, "_mp") == 0; diff --git a/src/ObjLoading/Game/IW4/ObjLoaderIW4.h b/src/ObjLoading/Game/IW4/ObjLoaderIW4.h index e19a5805..ab4e10b3 100644 --- a/src/ObjLoading/Game/IW4/ObjLoaderIW4.h +++ b/src/ObjLoading/Game/IW4/ObjLoaderIW4.h @@ -14,8 +14,6 @@ namespace IW4 public: ObjLoader(); - [[nodiscard]] bool SupportsZone(const Zone& zone) const override; - void LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone) const override; void UnloadContainersOfZone(Zone& zone) const override; diff --git a/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp b/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp index 6dbcec54..de35f87a 100644 --- a/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp +++ b/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp @@ -99,11 +99,6 @@ ObjLoader::ObjLoader() #undef REGISTER_ASSET_LOADER } -bool ObjLoader::SupportsZone(const Zone& zone) const -{ - return zone.m_game == &g_GameIW5; -} - bool ObjLoader::IsMpZone(const Zone& zone) { return zone.m_name.compare(0, 3, "mp_") == 0 || zone.m_name.compare(zone.m_name.length() - 3, 3, "_mp") == 0; diff --git a/src/ObjLoading/Game/IW5/ObjLoaderIW5.h b/src/ObjLoading/Game/IW5/ObjLoaderIW5.h index e60ee44d..2b259032 100644 --- a/src/ObjLoading/Game/IW5/ObjLoaderIW5.h +++ b/src/ObjLoading/Game/IW5/ObjLoaderIW5.h @@ -14,8 +14,6 @@ namespace IW5 public: ObjLoader(); - [[nodiscard]] bool SupportsZone(const Zone& zone) const override; - void LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone) const override; void UnloadContainersOfZone(Zone& zone) const override; diff --git a/src/ObjLoading/Game/T5/ObjLoaderT5.cpp b/src/ObjLoading/Game/T5/ObjLoaderT5.cpp index dd8f8522..3ec02cf4 100644 --- a/src/ObjLoading/Game/T5/ObjLoaderT5.cpp +++ b/src/ObjLoading/Game/T5/ObjLoaderT5.cpp @@ -56,11 +56,6 @@ ObjLoader::ObjLoader() #undef REGISTER_ASSET_LOADER } -bool ObjLoader::SupportsZone(const Zone& zone) const -{ - return zone.m_game == &g_GameT5; -} - bool ObjLoader::IsMpZone(const Zone& zone) { return zone.m_name.compare(0, 3, "mp_") == 0 || zone.m_name.compare(zone.m_name.length() - 3, 3, "_mp") == 0; diff --git a/src/ObjLoading/Game/T5/ObjLoaderT5.h b/src/ObjLoading/Game/T5/ObjLoaderT5.h index f8fadd5f..4ede43c4 100644 --- a/src/ObjLoading/Game/T5/ObjLoaderT5.h +++ b/src/ObjLoading/Game/T5/ObjLoaderT5.h @@ -14,8 +14,6 @@ namespace T5 public: ObjLoader(); - bool SupportsZone(const Zone& zone) const override; - void LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone) const override; void UnloadContainersOfZone(Zone& zone) const override; diff --git a/src/ObjLoading/Game/T6/ObjLoaderT6.cpp b/src/ObjLoading/Game/T6/ObjLoaderT6.cpp index 846c34d8..e272d454 100644 --- a/src/ObjLoading/Game/T6/ObjLoaderT6.cpp +++ b/src/ObjLoading/Game/T6/ObjLoaderT6.cpp @@ -125,11 +125,6 @@ namespace T6 #undef REGISTER_ASSET_LOADER } - bool ObjLoader::SupportsZone(const Zone& zone) const - { - return zone.m_game == &g_GameT6; - } - bool ObjLoader::VerifySoundBankChecksum(const SoundBank& soundBank, const SndRuntimeAssetBank& sndRuntimeAssetBank) { SoundAssetBankChecksum checksum{}; diff --git a/src/ObjLoading/Game/T6/ObjLoaderT6.h b/src/ObjLoading/Game/T6/ObjLoaderT6.h index e6cb0ee9..3e9aa741 100644 --- a/src/ObjLoading/Game/T6/ObjLoaderT6.h +++ b/src/ObjLoading/Game/T6/ObjLoaderT6.h @@ -19,8 +19,6 @@ namespace T6 public: ObjLoader(); - [[nodiscard]] bool SupportsZone(const Zone& zone) const override; - void LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone) const override; void UnloadContainersOfZone(Zone& zone) const override; diff --git a/src/ObjLoading/IObjLoader.cpp b/src/ObjLoading/IObjLoader.cpp new file mode 100644 index 00000000..de841138 --- /dev/null +++ b/src/ObjLoading/IObjLoader.cpp @@ -0,0 +1,27 @@ +#include "IObjLoader.h" + +#include "Game/IW3/ObjLoaderIW3.h" +#include "Game/IW4/ObjLoaderIW4.h" +#include "Game/IW5/ObjLoaderIW5.h" +#include "Game/T5/ObjLoaderT5.h" +#include "Game/T6/ObjLoaderT6.h" + +#include + +const IObjLoader* IObjLoader::GetObjLoaderForGame(GameId game) +{ + static const IObjLoader* zoneCreators[static_cast(GameId::COUNT)]{ + new IW3::ObjLoader(), + new IW4::ObjLoader(), + new IW5::ObjLoader(), + new T5::ObjLoader(), + new T6::ObjLoader(), + }; + static_assert(std::extent_v == static_cast(GameId::COUNT)); + + assert(static_cast(game) < static_cast(GameId::COUNT)); + const auto* result = zoneCreators[static_cast(game)]; + assert(result); + + return result; +} diff --git a/src/ObjLoading/IObjLoader.h b/src/ObjLoading/IObjLoader.h index b494fe33..9302b943 100644 --- a/src/ObjLoading/IObjLoader.h +++ b/src/ObjLoading/IObjLoader.h @@ -14,13 +14,6 @@ public: IObjLoader& operator=(const IObjLoader& other) = default; IObjLoader& operator=(IObjLoader&& other) noexcept = default; - /** - * \brief Checks whether this ObjLoader supports a specified zone. - * \param zone The zone to check. - * \return \c true if the specified zone is supported. - */ - [[nodiscard]] virtual bool SupportsZone(const Zone& zone) const = 0; - /** * \brief Loads all containers that are referenced by a specified zone. * \param searchPath The search path object to use to find the referenced containers. @@ -36,4 +29,6 @@ public: virtual bool LoadAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const = 0; virtual void FinalizeAssetsForZone(AssetLoadingContext& context) const = 0; + + static const IObjLoader* GetObjLoaderForGame(GameId game); }; diff --git a/src/ObjLoading/ObjLoading.cpp b/src/ObjLoading/ObjLoading.cpp index 2a0524e7..b50fac75 100644 --- a/src/ObjLoading/ObjLoading.cpp +++ b/src/ObjLoading/ObjLoading.cpp @@ -1,10 +1,5 @@ #include "ObjLoading.h" -#include "Game/IW3/ObjLoaderIW3.h" -#include "Game/IW4/ObjLoaderIW4.h" -#include "Game/IW5/ObjLoaderIW5.h" -#include "Game/T5/ObjLoaderT5.h" -#include "Game/T6/ObjLoaderT6.h" #include "IObjLoader.h" #include "ObjContainer/IWD/IWD.h" #include "SearchPath/SearchPaths.h" @@ -14,38 +9,6 @@ ObjLoading::Configuration_t ObjLoading::Configuration; -const IObjLoader* const OBJ_LOADERS[]{ - new IW3::ObjLoader(), - new IW4::ObjLoader(), - new IW5::ObjLoader(), - new T5::ObjLoader(), - new T6::ObjLoader(), -}; - -void ObjLoading::LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone) -{ - for (const auto* loader : OBJ_LOADERS) - { - if (loader->SupportsZone(zone)) - { - loader->LoadReferencedContainersForZone(searchPath, zone); - return; - } - } -} - -void ObjLoading::UnloadContainersOfZone(Zone& zone) -{ - for (const auto* loader : OBJ_LOADERS) - { - if (loader->SupportsZone(zone)) - { - loader->UnloadContainersOfZone(zone); - return; - } - } -} - void ObjLoading::LoadIWDsInSearchPath(ISearchPath& searchPath) { searchPath.Find(SearchPathSearchOptions().IncludeSubdirectories(false).FilterExtensions("iwd"), @@ -81,28 +44,3 @@ SearchPaths ObjLoading::GetIWDSearchPaths() return iwdPaths; } - -bool ObjLoading::LoadAssetForZone(AssetLoadingContext& context, const asset_type_t assetType, const std::string& assetName) -{ - for (const auto* loader : OBJ_LOADERS) - { - if (loader->SupportsZone(context.m_zone)) - { - return loader->LoadAssetForZone(context, assetType, assetName); - } - } - - return false; -} - -void ObjLoading::FinalizeAssetsForZone(AssetLoadingContext& context) -{ - for (const auto* loader : OBJ_LOADERS) - { - if (loader->SupportsZone(context.m_zone)) - { - loader->FinalizeAssetsForZone(context); - return; - } - } -} diff --git a/src/ObjLoading/ObjLoading.h b/src/ObjLoading/ObjLoading.h index c0baa1ad..372ef610 100644 --- a/src/ObjLoading/ObjLoading.h +++ b/src/ObjLoading/ObjLoading.h @@ -1,9 +1,7 @@ #pragma once -#include "AssetLoading/AssetLoadingContext.h" #include "SearchPath/ISearchPath.h" #include "SearchPath/SearchPaths.h" -#include "Zone/Zone.h" class ObjLoading { @@ -16,19 +14,6 @@ public: bool MenuNoOptimization = false; } Configuration; - /** - * \brief Loads all containers that are being referenced by the specified zone. - * \param searchPath The search path to use to find the referenced containers. - * \param zone The zone to load all referenced containers of. - */ - static void LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone); - - /** - * \brief Unloads all containers that were referenced by a specified zone. If referenced by more than one zone a container will only be unloaded once all - * referencing zones were unloaded the container. \param zone The zone to unload all referenced containers for. - */ - static void UnloadContainersOfZone(Zone& zone); - /** * \brief Loads all IWDs that can be found in a specified search path. * \param searchPath The search path that contains IWDs to be loaded. @@ -46,7 +31,4 @@ public: * \return A \c SearchPaths object containing all IWDs that are currently loaded. */ static SearchPaths GetIWDSearchPaths(); - - static bool LoadAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName); - static void FinalizeAssetsForZone(AssetLoadingContext& context); }; diff --git a/src/Unlinker/Unlinker.cpp b/src/Unlinker/Unlinker.cpp index e16d3825..c2ff656b 100644 --- a/src/Unlinker/Unlinker.cpp +++ b/src/Unlinker/Unlinker.cpp @@ -2,6 +2,7 @@ #include "ContentLister/ContentPrinter.h" #include "ContentLister/ZoneDefWriter.h" +#include "IObjLoader.h" #include "ObjContainer/IWD/IWD.h" #include "ObjLoading.h" #include "ObjWriting.h" @@ -325,7 +326,10 @@ private: std::cout << std::format("Loaded zone \"{}\"\n", zone->m_name); if (ShouldLoadObj()) - ObjLoading::LoadReferencedContainersForZone(searchPathsForZone, *zone); + { + const auto* objLoader = IObjLoader::GetObjLoaderForGame(zone->m_game->GetId()); + objLoader->LoadReferencedContainersForZone(searchPathsForZone, *zone); + } m_loaded_zones.emplace_back(std::move(zone)); } @@ -343,7 +347,10 @@ private: const auto zoneName = loadedZone->m_name; if (ShouldLoadObj()) - ObjLoading::UnloadContainersOfZone(*loadedZone); + { + const auto* objLoader = IObjLoader::GetObjLoaderForGame(loadedZone->m_game->GetId()); + objLoader->UnloadContainersOfZone(*loadedZone); + } loadedZone.reset(); @@ -383,14 +390,15 @@ private: if (m_args.m_verbose) std::cout << std::format("Loaded zone \"{}\"\n", zoneName); + const auto* objLoader = IObjLoader::GetObjLoaderForGame(zone->m_game->GetId()); if (ShouldLoadObj()) - ObjLoading::LoadReferencedContainersForZone(searchPathsForZone, *zone); + objLoader->LoadReferencedContainersForZone(searchPathsForZone, *zone); if (!HandleZone(searchPathsForZone, *zone)) return false; if (ShouldLoadObj()) - ObjLoading::UnloadContainersOfZone(*zone); + objLoader->UnloadContainersOfZone(*zone); zone.reset(); if (m_args.m_verbose)