mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Removed old self-consistency function.
This commit is contained in:
@@ -656,71 +656,6 @@ namespace boss {
|
||||
return issues;
|
||||
}
|
||||
|
||||
std::map<std::string,bool> Plugin::CheckSelfConsistency(const list<Plugin>& plugins, std::set<std::string> branch, set<std::string> incs, set<std::string> reqs) const {
|
||||
map<string,bool> issues;
|
||||
//Add this plugin and its incompatibilities to the set.
|
||||
if (!branch.insert(boost::to_lower_copy(name)).second) {
|
||||
issues.insert(pair<string, bool>(name, false));
|
||||
return issues; //Prevent infinite recursion.
|
||||
}
|
||||
for (set<File>::const_iterator it=incompatibilities.begin(), endit=incompatibilities.end(); it != endit; ++it) {
|
||||
incs.insert(boost::to_lower_copy(it->Name()));
|
||||
}
|
||||
|
||||
//Check 1: None of this plugin's masters or requirements or 'load after' plugins may be in branch.
|
||||
//Check 2: None of this plugin's masters or requirements or 'load after' plugins may be in incs.
|
||||
//Check 3: None of this plugin's incompatibilities may be present in branch.
|
||||
//Check 4: This plugin must not be present in incs.
|
||||
//Check 5: This plugin must not be present in branch (performed above).
|
||||
//Also check the consistency of the plugins this plugin is dependent on.
|
||||
for (vector<string>::const_iterator it=masters.begin(), endit=masters.end(); it != endit; ++it) {
|
||||
reqs.insert(boost::to_lower_copy(*it));
|
||||
if (branch.find(boost::to_lower_copy(*it)) != branch.end())
|
||||
issues.insert(pair<string, bool>(*it, true));
|
||||
if (incs.find(boost::to_lower_copy(*it)) != incs.end())
|
||||
issues.insert(pair<string, bool>(*it, false));
|
||||
list<Plugin>::const_iterator pluginIt = find(plugins.begin(), plugins.end(), *it);
|
||||
if (pluginIt != plugins.end()) {
|
||||
map<string,bool> childIssues = pluginIt->CheckSelfConsistency(plugins, branch, incs, reqs);
|
||||
issues.insert(childIssues.begin(), childIssues.end());
|
||||
}
|
||||
}
|
||||
for (set<File>::const_iterator it=requirements.begin(), endIt=requirements.end(); it != endIt; ++it) {
|
||||
reqs.insert(boost::to_lower_copy(it->Name()));
|
||||
if (branch.find(boost::to_lower_copy(it->Name())) != branch.end())
|
||||
issues.insert(pair<string, bool>(it->Name(), true));
|
||||
if (incs.find(boost::to_lower_copy(it->Name())) != incs.end())
|
||||
issues.insert(pair<string, bool>(it->Name(), false));
|
||||
list<Plugin>::const_iterator pluginIt = find(plugins.begin(), plugins.end(), *it);
|
||||
if (pluginIt != plugins.end()) {
|
||||
map<string,bool> childIssues = pluginIt->CheckSelfConsistency(plugins, branch, incs, reqs);
|
||||
issues.insert(childIssues.begin(), childIssues.end());
|
||||
}
|
||||
}
|
||||
for (set<File>::const_iterator it=loadAfter.begin(), endIt=loadAfter.end(); it != endIt; ++it) {
|
||||
reqs.insert(boost::to_lower_copy(it->Name()));
|
||||
if (branch.find(boost::to_lower_copy(it->Name())) != branch.end())
|
||||
issues.insert(pair<string, bool>(it->Name(), true));
|
||||
if (incs.find(boost::to_lower_copy(it->Name())) != incs.end())
|
||||
issues.insert(pair<string, bool>(it->Name(), false));
|
||||
list<Plugin>::const_iterator pluginIt = find(plugins.begin(), plugins.end(), *it);
|
||||
if (pluginIt != plugins.end()) {
|
||||
map<string,bool> childIssues = pluginIt->CheckSelfConsistency(plugins, branch, incs, reqs);
|
||||
issues.insert(childIssues.begin(), childIssues.end());
|
||||
}
|
||||
}
|
||||
for (set<File>::const_iterator it=incompatibilities.begin(), endIt=incompatibilities.end(); it != endIt; ++it) {
|
||||
if (branch.find(boost::to_lower_copy(it->Name())) != branch.end())
|
||||
issues.insert(pair<string, bool>(it->Name(), false));
|
||||
if (reqs.find(boost::to_lower_copy(it->Name())) != reqs.end())
|
||||
issues.insert(pair<string, bool>(it->Name(), false));
|
||||
}
|
||||
if (incs.find(boost::to_lower_copy(name)) != incs.end())
|
||||
issues.insert(pair<string, bool>(name, false));
|
||||
|
||||
return issues;
|
||||
}
|
||||
|
||||
bool operator == (const File& lhs, const Plugin& rhs) {
|
||||
return boost::iequals(lhs.Name(), rhs.Name());
|
||||
}
|
||||
|
||||
@@ -182,7 +182,6 @@ namespace boss {
|
||||
|
||||
//Validity checks.
|
||||
std::map<std::string,bool> CheckInstallValidity(const Game& game) const; //Checks that reqs and masters are all present, and that no incs are present. Returns a map of filenames and whether they are missing (if bool is true, then filename is a req or master, otherwise it's an inc).
|
||||
std::map<std::string,bool> CheckSelfConsistency(const std::list<Plugin>& plugins, std::set<std::string> branch, std::set<std::string> incs, std::set<std::string> reqs) const;
|
||||
private:
|
||||
std::string name;
|
||||
bool enabled; //Default to true.
|
||||
|
||||
Reference in New Issue
Block a user