From c6c89140b2a25b52e20baed52c22f982c957a70c Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 23 Jan 2024 23:59:08 +0100 Subject: [PATCH 1/2] fix: check correct array for emptyness when getting dependencies from marker --- src/ZoneLoading/Loading/AssetMarker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZoneLoading/Loading/AssetMarker.cpp b/src/ZoneLoading/Loading/AssetMarker.cpp index 8b20c5866..ecf14dd9e 100644 --- a/src/ZoneLoading/Loading/AssetMarker.cpp +++ b/src/ZoneLoading/Loading/AssetMarker.cpp @@ -47,7 +47,7 @@ XAssetInfoGeneric* AssetMarker::GetAssetInfoByName(std::string name) const std::vector AssetMarker::GetDependencies() const { std::vector dependencies; - if (!m_used_script_strings.empty()) + if (!m_dependencies.empty()) { dependencies.reserve(m_dependencies.size()); for (auto dependency : m_dependencies) From 3fd17fc6d30559dfaecf7d61e7b72ab6fcbfba3e Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 24 Jan 2024 00:16:09 +0100 Subject: [PATCH 2/2] fix: calculate requiring marking for structs even when called recursively --- .../MarkingRequiredPostProcessor.cpp | 16 +++++++++++++--- .../MarkingRequiredPostProcessor.h | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MarkingRequiredPostProcessor.cpp b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MarkingRequiredPostProcessor.cpp index 17b425585..439b41ff7 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MarkingRequiredPostProcessor.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MarkingRequiredPostProcessor.cpp @@ -6,7 +6,7 @@ #include -bool MarkingRequiredPostProcessor::RequiresMarking(std::unordered_set& visitedStructures, const StructureInformation* info) +bool MarkingRequiredPostProcessor::CalculateRequiresMarking(std::unordered_set& visitedStructures, StructureInformation* info) { if (visitedStructures.find(info) != visitedStructures.end()) return info->m_requires_marking; @@ -14,7 +14,10 @@ bool MarkingRequiredPostProcessor::RequiresMarking(std::unordered_setm_asset_enum_entry) + { + info->m_requires_marking = true; return true; + } for (const auto& member : info->m_ordered_members) { @@ -43,12 +46,19 @@ bool MarkingRequiredPostProcessor::RequiresMarking(std::unordered_setm_is_script_string || member->m_type && member->m_type->m_asset_enum_entry) + { + info->m_requires_marking = true; return true; + } - if (member->m_type != nullptr && member->m_type != info && RequiresMarking(visitedStructures, member->m_type)) + if (member->m_type != nullptr && member->m_type != info && CalculateRequiresMarking(visitedStructures, member->m_type)) + { + info->m_requires_marking = true; return true; + } } + info->m_requires_marking = false; return false; } @@ -59,7 +69,7 @@ bool MarkingRequiredPostProcessor::PostProcess(IDataRepository* repository) std::unordered_set visitedStructures; for (const auto& info : allInfos) { - info->m_requires_marking = RequiresMarking(visitedStructures, info); + CalculateRequiresMarking(visitedStructures, info); } return true; diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MarkingRequiredPostProcessor.h b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MarkingRequiredPostProcessor.h index 5d486c719..ad7f81652 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MarkingRequiredPostProcessor.h +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MarkingRequiredPostProcessor.h @@ -6,7 +6,7 @@ class MarkingRequiredPostProcessor final : public IPostProcessor { - static bool RequiresMarking(std::unordered_set& visitedStructures, const StructureInformation* info); + static bool CalculateRequiresMarking(std::unordered_set& visitedStructures, StructureInformation* info); public: bool PostProcess(IDataRepository* repository) override;