Skip to content

Commit

Permalink
Reverted gDependencies to use old system
Browse files Browse the repository at this point in the history
  • Loading branch information
KiritoDv committed May 16, 2024
1 parent 6a0fcac commit 572ea9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
15 changes: 6 additions & 9 deletions src/Companion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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
Expand Down Expand Up @@ -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(), '\\', '/');
Expand Down
8 changes: 1 addition & 7 deletions src/Companion.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ struct ParseResultData {
}
};

struct Dependency {
std::string name;
YAML::Node node;
bool processed;
};

class Companion {
public:
static Companion* Instance;
Expand Down Expand Up @@ -190,12 +184,12 @@ class Companion {
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);
Expand Down

0 comments on commit 572ea9d

Please sign in to comment.