chore: use marker template in loader for scriptstrings and dependencies

This commit is contained in:
Jan 2024-01-22 22:40:03 +01:00
parent 685a99577b
commit 91cbfa2bbb
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C

View File

@ -27,6 +27,13 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
return str.str(); return str.str();
} }
static std::string MarkerClassName(StructureInformation* asset)
{
std::ostringstream str;
str << "Marker_" << asset->m_definition->m_name;
return str.str();
}
static std::string VariableDecl(const DataDefinition* def) static std::string VariableDecl(const DataDefinition* def)
{ {
std::ostringstream str; std::ostringstream str;
@ -1063,7 +1070,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
m_intendation++; m_intendation++;
LINE("assert(pAsset != nullptr);") LINE("assert(pAsset != nullptr);")
LINE("m_asset_info = reinterpret_cast<XAssetInfo<" << info->m_definition->GetFullName() << ">*>(LinkAsset(GetAssetName(*pAsset), *pAsset));") LINE("")
LINE(MarkerClassName(m_env.m_asset) << " marker(m_zone);")
LINE("marker.Mark(*pAsset);")
LINE("")
LINE("m_asset_info = reinterpret_cast<XAssetInfo<"
<< info->m_definition->GetFullName() << ">*>(LinkAsset(GetAssetName(*pAsset), *pAsset, marker.GetUsedScriptStrings(), marker.GetDependencies()));")
LINE("*pAsset = m_asset_info->Asset();") LINE("*pAsset = m_asset_info->Asset();")
m_intendation--; m_intendation--;
@ -1236,6 +1248,7 @@ public:
LINE("// ====================================================================") LINE("// ====================================================================")
LINE("") LINE("")
LINE("#include \"" << Lower(m_env.m_asset->m_definition->m_name) << "_load_db.h\"") LINE("#include \"" << Lower(m_env.m_asset->m_definition->m_name) << "_load_db.h\"")
LINE("#include \"" << Lower(m_env.m_asset->m_definition->m_name) << "_mark_db.h\"")
LINE("#include <cassert>") LINE("#include <cassert>")
LINE("") LINE("")