From 572ea9d09643c7584e40a5b952e7fad8590661f3 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Thu, 16 May 2024 08:03:16 +0000 Subject: [PATCH] Reverted gDependencies to use old system --- src/Companion.cpp | 15 ++++++--------- src/Companion.h | 8 +------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Companion.cpp b/src/Companion.cpp index 75c077a..364f373 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -244,14 +244,14 @@ std::optional Companion::ParseNode(YAML::Node& node, std::strin return std::nullopt; } - for (auto& [name, node, processed] : this->gDependencies) { - if(processed) { + for (auto [fst, snd] : this->gAssetDependencies[this->gCurrentFile]) { + if(snd.second) { continue; } - std::string doutput = (this->gCurrentDirectory / name).string(); + std::string doutput = (this->gCurrentDirectory / fst).string(); std::replace(doutput.begin(), doutput.end(), '\\', '/'); - processed = true; - auto dResult = this->ParseNode(node, doutput); + this->gAssetDependencies[this->gCurrentFile][fst].second = true; + auto dResult = this->ParseNode(snd.first, doutput); if(dResult.has_value()) { this->gParseResults[this->gCurrentFile].push_back(dResult.value()); } @@ -262,7 +262,6 @@ std::optional Companion::ParseNode(YAML::Node& node, std::strin SPDLOG_INFO("Processed {}", name); - this->gDependencies.clear(); return ParseResultData { name, type, node, result @@ -1226,9 +1225,7 @@ std::optional> Companion::RegisterAsset(cons return std::nullopt; } - this->gDependencies.push_back(Dependency { - name, node, false - }); + this->gAssetDependencies[this->gCurrentFile][name] = std::make_pair(node, false); auto output = (this->gCurrentDirectory / name).string(); std::replace(output.begin(), output.end(), '\\', '/'); diff --git a/src/Companion.h b/src/Companion.h index 15a607c..7d287b2 100644 --- a/src/Companion.h +++ b/src/Companion.h @@ -99,12 +99,6 @@ struct ParseResultData { } }; -struct Dependency { - std::string name; - YAML::Node node; - bool processed; -}; - class Companion { public: static Companion* Instance; @@ -190,12 +184,12 @@ private: std::unordered_set gProcessedFiles; std::unordered_map> gParseResults; - std::vector gDependencies; std::unordered_map gModdedAssetPaths; std::variant, std::string> gWriteOrder; std::unordered_map> gFactories; std::unordered_map>> gWriteMap; + std::unordered_map>> gAssetDependencies; std::unordered_map>> gAddrMap; void ProcessFile(YAML::Node root);