diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-05-16 08:03:16 +0000 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2024-05-16 08:03:16 +0000 |
| commit | 572ea9d09643c7584e40a5b952e7fad8590661f3 (patch) | |
| tree | bab7930ee6ffb2388934326d3fd037e72a6a73a6 | |
| parent | 6a0fcac225978f4f91636276855306048f154d1d (diff) | |
Reverted gDependencies to use old system
| -rw-r--r-- | src/Companion.cpp | 15 | ||||
| -rw-r--r-- | 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<ParseResultData> 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<ParseResultData> 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<std::tuple<std::string, YAML::Node>> 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<std::string> gProcessedFiles; std::unordered_map<std::string, std::vector<ParseResultData>> gParseResults; - std::vector<Dependency> gDependencies; std::unordered_map<std::string, std::string> gModdedAssetPaths; std::variant<std::vector<std::string>, std::string> gWriteOrder; std::unordered_map<std::string, std::shared_ptr<BaseFactory>> gFactories; std::unordered_map<std::string, std::map<std::string, std::vector<WriteEntry>>> gWriteMap; + std::unordered_map<std::string, std::map<std::string, std::pair<YAML::Node, bool>>> gAssetDependencies; std::unordered_map<std::string, std::unordered_map<uint32_t, std::tuple<std::string, YAML::Node>>> gAddrMap; void ProcessFile(YAML::Node root); |
