From 2d2912741b3be11bedf79a9de9c7128eb0424d7a Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Fri, 27 Feb 2026 21:21:08 +0100 Subject: [PATCH] fix: not properly initializing sub asset pools --- src/ObjLoading/Asset/AssetCreationContext.cpp | 10 +++++++++- src/ObjLoading/Asset/IZoneAssetCreationState.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ObjLoading/Asset/AssetCreationContext.cpp b/src/ObjLoading/Asset/AssetCreationContext.cpp index f547d3e0..1e19f6ab 100644 --- a/src/ObjLoading/Asset/AssetCreationContext.cpp +++ b/src/ObjLoading/Asset/AssetCreationContext.cpp @@ -67,11 +67,15 @@ AssetCreationContext::AssetCreationContext(Zone& zone, const AssetCreatorCollect : ZoneAssetCreationStateContainer(zone), m_zone(zone), m_forced_asset_pools(std::make_unique(zone, zone.m_priority)), - m_sub_asset_pools(IGame::GetGameById(zone.m_game_id)->GetSubAssetTypeCount()), m_creators(creators), m_ignored_asset_lookup(ignoredAssetLookup), m_forced_load_depth(0u) { + const auto subAssetTypeCount = IGame::GetGameById(zone.m_game_id)->GetSubAssetTypeCount(); + m_sub_asset_pools.resize(subAssetTypeCount); + + for (asset_type_t subAssetType = 0; subAssetType < subAssetTypeCount; subAssetType++) + m_sub_asset_pools[subAssetType] = std::make_unique(); } XAssetInfoGeneric* AssetCreationContext::AddAssetGeneric(GenericAssetRegistration registration) const @@ -171,6 +175,10 @@ XAssetInfoGeneric* AssetCreationContext::LoadSubAssetGeneric(const asset_type_t con::error(R"(Could not load sub asset "{}" of type "{}")", assetName, *IGame::GetGameById(m_zone.m_game_id)->GetSubAssetTypeName(subAssetType)); } + else + { + con::error(R"(Missing sub asset "{}" of type "{}")", assetName, *IGame::GetGameById(m_zone.m_game_id)->GetSubAssetTypeName(subAssetType)); + } return nullptr; } diff --git a/src/ObjLoading/Asset/IZoneAssetCreationState.h b/src/ObjLoading/Asset/IZoneAssetCreationState.h index 5692f553..44e5d204 100644 --- a/src/ObjLoading/Asset/IZoneAssetCreationState.h +++ b/src/ObjLoading/Asset/IZoneAssetCreationState.h @@ -42,7 +42,7 @@ public: class ZoneAssetCreationStateContainer { public: - ZoneAssetCreationStateContainer(Zone& zone) + explicit ZoneAssetCreationStateContainer(Zone& zone) : m_injection(*this, zone) { }