2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-05 12:33:02 +00:00

fix: not properly initializing sub asset pools

This commit is contained in:
Jan Laupetin
2026-02-27 21:21:08 +01:00
parent 2e3b5501b6
commit 2d2912741b
2 changed files with 10 additions and 2 deletions

View File

@@ -67,11 +67,15 @@ AssetCreationContext::AssetCreationContext(Zone& zone, const AssetCreatorCollect
: ZoneAssetCreationStateContainer(zone),
m_zone(zone),
m_forced_asset_pools(std::make_unique<ZoneAssetPools>(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<AssetPool>();
}
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;
}

View File

@@ -42,7 +42,7 @@ public:
class ZoneAssetCreationStateContainer
{
public:
ZoneAssetCreationStateContainer(Zone& zone)
explicit ZoneAssetCreationStateContainer(Zone& zone)
: m_injection(*this, zone)
{
}