2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-08-30 21:53:15 +00:00

fix: messed up kvp compiler reference

This commit is contained in:
Jan Laupetin
2025-08-06 00:31:52 +01:00
parent 46fb919a52
commit fdef6797aa
3 changed files with 8 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ namespace
: m_memory(memory),
m_zone(zone),
m_zone_definition(zoneDefinition),
m_kvp_creator(zoneStates.GetZoneAssetCreationState<::key_value_pairs::Creator>())
m_kvp_creator(zoneStates.GetZoneAssetCreationState<key_value_pairs::Creator>())
{
}
@@ -67,7 +67,7 @@ namespace
MemoryManager& m_memory;
const Zone& m_zone;
const ZoneDefinition& m_zone_definition;
::key_value_pairs::Creator m_kvp_creator;
key_value_pairs::Creator& m_kvp_creator;
};
} // namespace

View File

@@ -52,14 +52,15 @@ public:
static_assert(std::is_base_of_v<IZoneAssetCreationState, T>, "T must inherit IZoneAssetCreationState");
// T must also have a public default constructor
const auto foundEntry = m_zone_asset_creation_states.find(typeid(T));
std::type_index typeId = typeid(T);
const auto foundEntry = m_zone_asset_creation_states.find(typeId);
if (foundEntry != m_zone_asset_creation_states.end())
return *dynamic_cast<T*>(foundEntry->second.get());
auto newState = std::make_unique<T>();
newState->Inject(m_injection);
auto* newStatePtr = newState.get();
m_zone_asset_creation_states.emplace(std::make_pair<std::type_index, std::unique_ptr<IZoneAssetCreationState>>(typeid(T), std::move(newState)));
m_zone_asset_creation_states.emplace(std::move(typeId), std::move(newState));
return *newStatePtr;
}

View File

@@ -43,7 +43,7 @@ namespace
IgnoredAssetLookup m_ignored_assets;
AssetCreationContext m_context;
::key_value_pairs::Creator& m_kvp_creator;
key_value_pairs::Creator& m_kvp_creator;
};
} // namespace
@@ -81,7 +81,7 @@ namespace test::game::t6::keyvaluepairs
TestContext testContext;
const auto sut = testContext.CreateSut();
testContext.m_kvp_creator.AddKeyValuePair(::key_value_pairs::CommonKeyValuePair("ipak_read", "test_ipak"));
testContext.m_kvp_creator.AddKeyValuePair(key_value_pairs::CommonKeyValuePair("ipak_read", "test_ipak"));
sut->FinalizeZone(testContext.m_context);
@@ -107,7 +107,7 @@ namespace test::game::t6::keyvaluepairs
TestContext testContext;
const auto sut = testContext.CreateSut();
testContext.m_kvp_creator.AddKeyValuePair(::key_value_pairs::CommonKeyValuePair(0xDDEEFFAA, "hello_there"));
testContext.m_kvp_creator.AddKeyValuePair(key_value_pairs::CommonKeyValuePair(0xDDEEFFAA, "hello_there"));
sut->FinalizeZone(testContext.m_context);