mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
More C++11 changes.
* Made a few standard library replacements missed in the API. * Swapped in the range syntax with the auto keyword in for loops where appropriate.
This commit is contained in:
+39
-40
@@ -121,7 +121,7 @@ struct _loot_db_int {
|
||||
loot::Game game;
|
||||
std::list<loot::Plugin> metadata, rawMetadata, userMetadata, rawUserMetadata;
|
||||
|
||||
boost::unordered_map<std::string, unsigned int> bashTagMap;
|
||||
std::unordered_map<std::string, unsigned int> bashTagMap;
|
||||
|
||||
char ** extTagMap;
|
||||
|
||||
@@ -344,7 +344,7 @@ LOOT_API unsigned int loot_eval_lists (loot_db db, const unsigned int language)
|
||||
std::list<loot::Plugin> temp = db->rawMetadata;
|
||||
try {
|
||||
db->game.RefreshActivePluginsList();
|
||||
for (std::list<loot::Plugin>::iterator it=temp.begin(); it != temp.end();) {
|
||||
for (auto it=temp.begin(); it != temp.end();) {
|
||||
it->EvalAllConditions(db->game, language);
|
||||
if (it->IsRegexPlugin()) {
|
||||
boost::regex regex;
|
||||
@@ -374,7 +374,7 @@ LOOT_API unsigned int loot_eval_lists (loot_db db, const unsigned int language)
|
||||
|
||||
temp = db->rawUserMetadata;
|
||||
try {
|
||||
for (std::list<loot::Plugin>::iterator it=temp.begin(); it != temp.end();) {
|
||||
for (auto it=temp.begin(); it != temp.end();) {
|
||||
it->EvalAllConditions(db->game, language);
|
||||
if (it->IsRegexPlugin()) {
|
||||
boost::regex regex;
|
||||
@@ -430,18 +430,18 @@ LOOT_API unsigned int loot_get_tag_map (loot_db db, char *** const tagMap, size_
|
||||
*tagMap = NULL;
|
||||
*numTags = 0;
|
||||
|
||||
boost::unordered_set<std::string> allTags;
|
||||
std::unordered_set<std::string> allTags;
|
||||
|
||||
for (std::list<loot::Plugin>::iterator it=db->metadata.begin(), endIt=db->metadata.end(); it != endIt; ++it) {
|
||||
std::set<loot::Tag> tags = it->Tags();
|
||||
for (std::set<loot::Tag>::const_iterator jt=tags.begin(), endJt=tags.end(); jt != endJt; ++jt) {
|
||||
allTags.insert(jt->Name());
|
||||
for (const auto &plugin: db->metadata) {
|
||||
std::set<loot::Tag> tags(plugin.Tags());
|
||||
for (const auto &tag: tags) {
|
||||
allTags.insert(tag.Name());
|
||||
}
|
||||
}
|
||||
for (std::list<loot::Plugin>::iterator it=db->userMetadata.begin(), endIt=db->userMetadata.end(); it != endIt; ++it) {
|
||||
std::set<loot::Tag> tags = it->Tags();
|
||||
for (std::set<loot::Tag>::const_iterator jt=tags.begin(), endJt=tags.end(); jt != endJt; ++jt) {
|
||||
allTags.insert(jt->Name());
|
||||
for (const auto &plugin : db->userMetadata) {
|
||||
std::set<loot::Tag> tags(plugin.Tags());
|
||||
for (const auto &tag : tags) {
|
||||
allTags.insert(tag.Name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,10 +456,10 @@ LOOT_API unsigned int loot_get_tag_map (loot_db db, char *** const tagMap, size_
|
||||
|
||||
unsigned int UID = 0;
|
||||
try {
|
||||
for (boost::unordered_set<std::string>::const_iterator it=allTags.begin(), endIt=allTags.end(); it != endIt; ++it) {
|
||||
db->bashTagMap.emplace(*it, UID);
|
||||
for (const auto &tag: allTags) {
|
||||
db->bashTagMap.emplace(tag, UID);
|
||||
//Also allocate memory.
|
||||
db->extTagMap[UID] = ToNewCString(*it);
|
||||
db->extTagMap[UID] = ToNewCString(tag);
|
||||
UID++;
|
||||
}
|
||||
} catch (std::bad_alloc& e) {
|
||||
@@ -502,28 +502,27 @@ LOOT_API unsigned int loot_get_plugin_tags (loot_db db, const char * const plugi
|
||||
*numTags_added = 0;
|
||||
*numTags_removed = 0;
|
||||
|
||||
boost::unordered_set<std::string> tagsAdded, tagsRemoved;
|
||||
std::unordered_set<std::string> tagsAdded, tagsRemoved;
|
||||
std::list<loot::Plugin>::iterator pluginIt = std::find(db->metadata.begin(), db->metadata.end(), loot::Plugin(plugin));
|
||||
if (pluginIt != db->metadata.end()) {
|
||||
std::set<loot::Tag> tags = pluginIt->Tags();
|
||||
for (std::set<loot::Tag>::const_iterator it=tags.begin(), endIt=tags.end(); it != endIt; ++it) {
|
||||
if (it->IsAddition())
|
||||
tagsAdded.insert(it->Name());
|
||||
std::set<loot::Tag> tags(pluginIt->Tags());
|
||||
for (const auto &tag: tags) {
|
||||
if (tag.IsAddition())
|
||||
tagsAdded.insert(tag.Name());
|
||||
else
|
||||
tagsRemoved.insert(it->Name());
|
||||
tagsRemoved.insert(tag.Name());
|
||||
}
|
||||
}
|
||||
|
||||
pluginIt = std::find(db->userMetadata.begin(), db->userMetadata.end(), loot::Plugin(plugin));
|
||||
if (pluginIt != db->userMetadata.end()) {
|
||||
*userlistModified = true;
|
||||
std::set<loot::Tag> tags = pluginIt->Tags();
|
||||
for (std::set<loot::Tag>::const_iterator it = tags.begin(), endIt = tags.end(); it != endIt; ++it) {
|
||||
if (it->IsAddition())
|
||||
tagsAdded.insert(it->Name());
|
||||
std::set<loot::Tag> tags(pluginIt->Tags());
|
||||
for (const auto &tag : tags) {
|
||||
if (tag.IsAddition())
|
||||
tagsAdded.insert(tag.Name());
|
||||
else
|
||||
tagsRemoved.insert(it->Name());
|
||||
|
||||
tagsRemoved.insert(tag.Name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,15 +531,15 @@ LOOT_API unsigned int loot_get_plugin_tags (loot_db db, const char * const plugi
|
||||
}
|
||||
|
||||
std::vector<unsigned int> tagsAddedIDs, tagsRemovedIDs;
|
||||
for (boost::unordered_set<std::string>::const_iterator it=tagsAdded.begin(), endIt=tagsAdded.end(); it != endIt; ++it) {
|
||||
boost::unordered_map<std::string, unsigned int>::const_iterator mapIter = db->bashTagMap.find(*it);
|
||||
for (const auto &tagNames: tagsAdded) {
|
||||
const auto mapIter(db->bashTagMap.find(tagNames));
|
||||
if (mapIter != db->bashTagMap.end())
|
||||
tagsAddedIDs.push_back(mapIter->second);
|
||||
}
|
||||
for (boost::unordered_set<std::string>::const_iterator it=tagsRemoved.begin(), endIt=tagsRemoved.end(); it != endIt; ++it) {
|
||||
boost::unordered_map<std::string, unsigned int>::const_iterator mapIter = db->bashTagMap.find(*it);
|
||||
for (const auto &tagNames : tagsRemoved) {
|
||||
const auto mapIter(db->bashTagMap.find(tagNames));
|
||||
if (mapIter != db->bashTagMap.end())
|
||||
tagsRemovedIDs.push_back(mapIter->second);
|
||||
tagsAddedIDs.push_back(mapIter->second);
|
||||
}
|
||||
|
||||
//Allocate memory.
|
||||
@@ -608,9 +607,9 @@ LOOT_API unsigned int loot_get_plugin_messages (loot_db db, const char * const p
|
||||
try {
|
||||
db->extMessageArray = new loot_message[db->extMessageArraySize];
|
||||
int i = 0;
|
||||
for (std::list<loot::Message>::const_iterator it=pluginMessages.begin(), endIt=pluginMessages.end(); it != endIt; ++it) {
|
||||
db->extMessageArray[i].type = it->Type();
|
||||
db->extMessageArray[i].message = ToNewCString(it->ChooseContent(loot::Language::any).Str());
|
||||
for (const auto &message: pluginMessages) {
|
||||
db->extMessageArray[i].type = message.Type();
|
||||
db->extMessageArray[i].message = ToNewCString(message.ChooseContent(loot::Language::any).Str());
|
||||
}
|
||||
} catch (std::bad_alloc& e) {
|
||||
return c_error(loot_error_no_mem, e.what());
|
||||
@@ -660,12 +659,12 @@ LOOT_API unsigned int loot_write_minimal_list (loot_db db, const char * const ou
|
||||
return c_error(loot_error_invalid_args, "Output file exists but overwrite is not set to true.");
|
||||
|
||||
std::list<loot::Plugin> temp = db->metadata;
|
||||
for (std::list<loot::Plugin>::iterator it=temp.begin(), endIt=temp.end(); it != endIt; ++it) {
|
||||
loot::Plugin p(it->Name());
|
||||
p.Tags(it->Tags());
|
||||
p.DirtyInfo(it->DirtyInfo());
|
||||
for (auto &plugin: temp) {
|
||||
loot::Plugin p(plugin.Name());
|
||||
p.Tags(plugin.Tags());
|
||||
p.DirtyInfo(plugin.DirtyInfo());
|
||||
|
||||
*it = p;
|
||||
plugin = p;
|
||||
}
|
||||
|
||||
YAML::Emitter yout;
|
||||
|
||||
@@ -443,9 +443,9 @@ namespace loot {
|
||||
pluginArrSize = loadOrder.size();
|
||||
pluginArr = new char*[pluginArrSize];
|
||||
int i = 0;
|
||||
for (list<Plugin>::const_iterator it=loadOrder.begin(),endIt=loadOrder.end(); it != endIt; ++it) {
|
||||
pluginArr[i] = new char[it->Name().length() + 1];
|
||||
strcpy(pluginArr[i], it->Name().c_str());
|
||||
for (const auto &plugin: loadOrder) {
|
||||
pluginArr[i] = new char[plugin.Name().length() + 1];
|
||||
strcpy(pluginArr[i], plugin.Name().c_str());
|
||||
++i;
|
||||
}
|
||||
|
||||
@@ -492,9 +492,9 @@ namespace loot {
|
||||
|
||||
lastTime = fs::last_write_time(filepath);
|
||||
|
||||
for (list<string>::const_iterator it = loadorder.begin(), itend = loadorder.end(); it != itend; ++it) {
|
||||
for (const auto &pluginName: loadorder) {
|
||||
|
||||
filepath = DataPath() / *it;
|
||||
filepath = DataPath() / pluginName;
|
||||
if (!fs::exists(filepath) && fs::exists(filepath.string() + ".ghost"))
|
||||
filepath += ".ghost";
|
||||
|
||||
@@ -524,8 +524,8 @@ namespace loot {
|
||||
}
|
||||
}
|
||||
|
||||
for (unordered_map<string, Plugin>::iterator it = plugins.begin(), itend = plugins.end(); it != itend; ++it) {
|
||||
it->second = Plugin(*this, it->second.Name(), headersOnly);
|
||||
for (auto &pluginPair: plugins) {
|
||||
pluginPair.second = Plugin(*this, pluginPair.second.Name(), headersOnly);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+39
-39
@@ -61,19 +61,19 @@ namespace loot {
|
||||
std::list<std::string> lhs_names, rhs_names;
|
||||
std::list<Message> lhs_messages, rhs_messages;
|
||||
|
||||
for (YAML::const_iterator it = lhs.begin(); it != lhs.end(); ++it) {
|
||||
if ((*it)["name"])
|
||||
lhs_names.push_back((*it)["name"].as<std::string>());
|
||||
if ((*it)["messages"]) {
|
||||
std::list<Message> messages = (*it)["messages"].as< std::list<Message> >();
|
||||
for (const auto &element: lhs) {
|
||||
if (element["name"])
|
||||
lhs_names.push_back(element["name"].as<std::string>());
|
||||
if (element["messages"]) {
|
||||
std::list<Message> messages = element["messages"].as< std::list<Message> >();
|
||||
lhs_messages.insert(lhs_messages.end(), messages.begin(), messages.end());
|
||||
}
|
||||
}
|
||||
for (YAML::const_iterator it = rhs.begin(); it != rhs.end(); ++it) {
|
||||
if ((*it)["name"])
|
||||
rhs_names.push_back((*it)["name"].as<std::string>());
|
||||
if ((*it)["messages"]) {
|
||||
std::list<Message> messages = (*it)["messages"].as< std::list<Message> >();
|
||||
for (const auto &element: rhs) {
|
||||
if (element["name"])
|
||||
rhs_names.push_back(element["name"].as<std::string>());
|
||||
if (element["messages"]) {
|
||||
std::list<Message> messages = element["messages"].as< std::list<Message> >();
|
||||
rhs_messages.insert(rhs_messages.end(), messages.begin(), messages.end());
|
||||
}
|
||||
}
|
||||
@@ -166,11 +166,11 @@ namespace loot {
|
||||
std::set<Tag> tags = plugin.Tags();
|
||||
std::set<Tag> tagsAdd, tagsRemove;
|
||||
if (!tags.empty()) {
|
||||
for (std::set<Tag>::const_iterator it = tags.begin(), endit = tags.end(); it != endit; ++it) {
|
||||
if (it->IsAddition())
|
||||
tagsAdd.insert(*it);
|
||||
for (const auto &tag: tags) {
|
||||
if (tag.IsAddition())
|
||||
tagsAdd.insert(tag);
|
||||
else
|
||||
tagsRemove.insert(*it);
|
||||
tagsRemove.insert(tag);
|
||||
}
|
||||
if (!tagsAdd.empty()) {
|
||||
out << YAML::Key << "tagsAdd"
|
||||
@@ -184,28 +184,28 @@ namespace loot {
|
||||
|
||||
std::list<Message> messages = plugin.Messages();
|
||||
std::set<PluginDirtyInfo> dirtyInfo = plugin.DirtyInfo();
|
||||
for (std::set<PluginDirtyInfo>::const_iterator it = dirtyInfo.begin(), endit = dirtyInfo.end(); it != endit; ++it) {
|
||||
for (const auto &element: dirtyInfo) {
|
||||
boost::format f;
|
||||
if (it->ITMs() > 0 && it->UDRs() > 0 && it->DeletedNavmeshes() > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records, %2% UDR records and %3% deleted navmeshes. Clean with %4%.")) % it->ITMs() % it->UDRs() % it->DeletedNavmeshes() % it->CleaningUtility();
|
||||
else if (it->ITMs() == 0 && it->UDRs() == 0 && it->DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Clean with %1%.")) % it->CleaningUtility();
|
||||
if (element.ITMs() > 0 && element.UDRs() > 0 && element.DeletedNavmeshes() > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records, %2% UDR records and %3% deleted navmeshes. Clean with %4%.")) % element.ITMs() % element.UDRs() % element.DeletedNavmeshes() % element.CleaningUtility();
|
||||
else if (element.ITMs() == 0 && element.UDRs() == 0 && element.DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Clean with %1%.")) % element.CleaningUtility();
|
||||
|
||||
|
||||
else if (it->ITMs() == 0 && it->UDRs() > 0 && it->DeletedNavmeshes() > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% UDR records and %2% deleted navmeshes. Clean with %3%.")) % it->UDRs() % it->DeletedNavmeshes() % it->CleaningUtility();
|
||||
else if (it->ITMs() == 0 && it->UDRs() == 0 && it->DeletedNavmeshes() > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% deleted navmeshes. Clean with %2%.")) % it->DeletedNavmeshes() % it->CleaningUtility();
|
||||
else if (it->ITMs() == 0 && it->UDRs() > 0 && it->DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% UDR records. Clean with %2%.")) % it->UDRs() % it->CleaningUtility();
|
||||
else if (element.ITMs() == 0 && element.UDRs() > 0 && element.DeletedNavmeshes() > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% UDR records and %2% deleted navmeshes. Clean with %3%.")) % element.UDRs() % element.DeletedNavmeshes() % element.CleaningUtility();
|
||||
else if (element.ITMs() == 0 && element.UDRs() == 0 && element.DeletedNavmeshes() > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% deleted navmeshes. Clean with %2%.")) % element.DeletedNavmeshes() % element.CleaningUtility();
|
||||
else if (element.ITMs() == 0 && element.UDRs() > 0 && element.DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% UDR records. Clean with %2%.")) % element.UDRs() % element.CleaningUtility();
|
||||
|
||||
else if (it->ITMs() > 0 && it->UDRs() == 0 && it->DeletedNavmeshes() > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% deleted navmeshes. Clean with %3%.")) % it->ITMs() % it->DeletedNavmeshes() % it->CleaningUtility();
|
||||
else if (it->ITMs() > 0 && it->UDRs() == 0 && it->DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records. Clean with %2%.")) % it->ITMs() % it->CleaningUtility();
|
||||
else if (element.ITMs() > 0 && element.UDRs() == 0 && element.DeletedNavmeshes() > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% deleted navmeshes. Clean with %3%.")) % element.ITMs() % element.DeletedNavmeshes() % element.CleaningUtility();
|
||||
else if (element.ITMs() > 0 && element.UDRs() == 0 && element.DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records. Clean with %2%.")) % element.ITMs() % element.CleaningUtility();
|
||||
|
||||
else if (it->ITMs() > 0 && it->UDRs() > 0 && it->DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% UDR records. Clean with %3%.")) % it->ITMs() % it->UDRs() % it->CleaningUtility();
|
||||
else if (element.ITMs() > 0 && element.UDRs() > 0 && element.DeletedNavmeshes() == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% UDR records. Clean with %3%.")) % element.ITMs() % element.UDRs() % element.CleaningUtility();
|
||||
|
||||
messages.push_back(loot::Message(loot::Message::warn, f.str()));
|
||||
}
|
||||
@@ -213,8 +213,8 @@ namespace loot {
|
||||
if (!messages.empty()) {
|
||||
out << YAML::Key << "messages"
|
||||
<< YAML::Value << YAML::BeginSeq;
|
||||
for (std::list<Message>::const_iterator it = messages.begin(), endit = messages.end(); it != endit; ++it) {
|
||||
WriteMessage(out, *it);
|
||||
for (const auto &message: messages) {
|
||||
WriteMessage(out, message);
|
||||
}
|
||||
out << YAML::EndSeq;
|
||||
}
|
||||
@@ -273,8 +273,8 @@ namespace loot {
|
||||
tempout.SetMapFormat(YAML::Flow);
|
||||
|
||||
tempout << YAML::BeginSeq;
|
||||
for (std::list<Plugin>::const_iterator it = plugins.begin(), endit = plugins.end(); it != endit; ++it) {
|
||||
WritePlugin(tempout, *it, game);
|
||||
for (const auto &plugin: plugins) {
|
||||
WritePlugin(tempout, plugin, game);
|
||||
}
|
||||
tempout << YAML::EndSeq;
|
||||
|
||||
@@ -286,8 +286,8 @@ namespace loot {
|
||||
//Need to generate output twice because passing the node causes !<!> to be written before every key and value for some reason.
|
||||
yout << YAML::Key << "plugins"
|
||||
<< YAML::Value << YAML::BeginSeq;
|
||||
for (std::list<Plugin>::const_iterator it = plugins.begin(), endit = plugins.end(); it != endit; ++it) {
|
||||
WritePlugin(yout, *it, game);
|
||||
for (const auto &plugin: plugins) {
|
||||
WritePlugin(yout, plugin, game);
|
||||
}
|
||||
yout << YAML::EndSeq;
|
||||
}
|
||||
@@ -298,8 +298,8 @@ namespace loot {
|
||||
BOOST_LOG_TRIVIAL(debug) << "Generating JSON general message data.";
|
||||
yout << YAML::Key << "globalMessages"
|
||||
<< YAML::Value << YAML::BeginSeq;
|
||||
for (std::list<Message>::const_iterator it = messages.begin(), endit = messages.end(); it != endit; ++it) {
|
||||
WriteMessage(yout, *it);
|
||||
for (const auto &message: messages) {
|
||||
WriteMessage(yout, message);
|
||||
}
|
||||
yout << YAML::EndSeq;
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace YAML {
|
||||
template<class T, class Compare>
|
||||
Emitter& operator << (Emitter& out, const std::set<T, Compare>& rhs) {
|
||||
out << BeginSeq;
|
||||
for (typename std::set<T, Compare>::const_iterator it=rhs.begin(), endIt=rhs.end(); it != endIt; ++it) {
|
||||
out << *it;
|
||||
for (const auto &element: rhs) {
|
||||
out << element;
|
||||
}
|
||||
out << EndSeq;
|
||||
|
||||
|
||||
+13
-13
@@ -96,9 +96,9 @@ namespace loot {
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Calculated order: ";
|
||||
list<loot::Plugin> tempPlugins;
|
||||
for (std::list<vertex_t>::iterator it = sortedVertices.begin(), endit = sortedVertices.end(); it != endit; ++it) {
|
||||
BOOST_LOG_TRIVIAL(info) << '\t' << graph[*it].Name();
|
||||
tempPlugins.push_back(graph[*it]);
|
||||
for (const auto &vertex: sortedVertices) {
|
||||
BOOST_LOG_TRIVIAL(info) << '\t' << graph[vertex].Name();
|
||||
tempPlugins.push_back(graph[vertex]);
|
||||
}
|
||||
plugins.swap(tempPlugins);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ namespace loot {
|
||||
boost::depth_first_search(graph, visitor(vis).vertex_index_map(v_index_map));
|
||||
}
|
||||
|
||||
void AddSpecificEdges(PluginGraph& graph, std::map<std::string, int>& overridenPriorities) {
|
||||
void AddSpecificEdges(PluginGraph& graph, std::map<std::string, int>& overriddenPriorities) {
|
||||
//Add edges for all relationships that aren't overlaps or priority differences.
|
||||
loot::vertex_it vit, vitend;
|
||||
for (boost::tie(vit, vitend) = boost::vertices(graph); vit != vitend; ++vit) {
|
||||
@@ -157,8 +157,8 @@ namespace loot {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding in-edges for masters.";
|
||||
vector<string> strVec(graph[*vit].Masters());
|
||||
for (vector<string>::const_iterator it=strVec.begin(), itend=strVec.end(); it != itend; ++it) {
|
||||
if (loot::GetVertexByName(graph, *it, parentVertex) &&
|
||||
for (const auto &master: strVec) {
|
||||
if (loot::GetVertexByName(graph, master, parentVertex) &&
|
||||
!boost::edge(parentVertex, *vit, graph).second) {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding edge from \"" << graph[parentVertex].Name() << "\" to \"" << graph[*vit].Name() << "\".";
|
||||
@@ -173,9 +173,9 @@ namespace loot {
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding in-edges for requirements.";
|
||||
set<File> fileset(graph[*vit].Reqs());
|
||||
for (set<File>::const_iterator it=fileset.begin(), itend=fileset.end(); it != itend; ++it) {
|
||||
if (loot::IsPlugin(it->Name()) &&
|
||||
loot::GetVertexByName(graph, it->Name(), parentVertex) &&
|
||||
for (const auto &file: fileset) {
|
||||
if (loot::IsPlugin(file.Name()) &&
|
||||
loot::GetVertexByName(graph, file.Name(), parentVertex) &&
|
||||
!boost::edge(parentVertex, *vit, graph).second) {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding edge from \"" << graph[parentVertex].Name() << "\" to \"" << graph[*vit].Name() << "\".";
|
||||
@@ -191,9 +191,9 @@ namespace loot {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding in-edges for 'load after's.";
|
||||
fileset = graph[*vit].LoadAfter();
|
||||
for (set<File>::const_iterator it=fileset.begin(), itend=fileset.end(); it != itend; ++it) {
|
||||
if (loot::IsPlugin(it->Name()) &&
|
||||
loot::GetVertexByName(graph, it->Name(), parentVertex) &&
|
||||
for (const auto &file : fileset) {
|
||||
if (loot::IsPlugin(file.Name()) &&
|
||||
loot::GetVertexByName(graph, file.Name(), parentVertex) &&
|
||||
!boost::edge(parentVertex, *vit, graph).second) {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding edge from \"" << graph[parentVertex].Name() << "\" to \"" << graph[*vit].Name() << "\".";
|
||||
@@ -211,7 +211,7 @@ namespace loot {
|
||||
//Set the current plugin's priority to parentPlugin.
|
||||
if (parentPriority > 0 && graph[*vit].Priority() < parentPriority) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Overriding priority for " << graph[*vit].Name() << " from " << graph[*vit].Priority() << " to " << parentPriority;
|
||||
overridenPriorities.insert(pair<string, int>(graph[*vit].Name(), graph[*vit].Priority()));
|
||||
overriddenPriorities.insert(pair<string, int>(graph[*vit].Name(), graph[*vit].Priority()));
|
||||
graph[*vit].Priority(parentPriority);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ namespace loot {
|
||||
|
||||
void CheckForCycles(const PluginGraph& graph);
|
||||
|
||||
void AddSpecificEdges(PluginGraph& graph, std::map<std::string, int>& overridenPriorities);
|
||||
void AddSpecificEdges(PluginGraph& graph, std::map<std::string, int>& overriddenPriorities);
|
||||
|
||||
void AddPriorityEdges(PluginGraph& graph);
|
||||
|
||||
|
||||
+43
-41
@@ -207,12 +207,13 @@ namespace loot {
|
||||
_content.resize(1);
|
||||
else {
|
||||
MessageContent english, match;
|
||||
for (vector<MessageContent>::const_iterator it=_content.begin(), endit=_content.end(); it != endit; ++it) {
|
||||
if (it->Language() == language) {
|
||||
match = *it;
|
||||
for (const auto &mc: _content) {
|
||||
if (mc.Language() == language) {
|
||||
match = mc;
|
||||
break;
|
||||
} else if (it->Language() == Language::english)
|
||||
english = *it;
|
||||
}
|
||||
else if (mc.Language() == Language::english)
|
||||
english = mc;
|
||||
}
|
||||
_content.resize(1);
|
||||
if (!match.Str().empty())
|
||||
@@ -230,12 +231,13 @@ namespace loot {
|
||||
return _content[0];
|
||||
else {
|
||||
MessageContent english, match;
|
||||
for (vector<MessageContent>::const_iterator it=_content.begin(), endit=_content.end(); it != endit; ++it) {
|
||||
if (it->Language() == language) {
|
||||
match = *it;
|
||||
for (const auto &mc : _content) {
|
||||
if (mc.Language() == language) {
|
||||
match = mc;
|
||||
break;
|
||||
} else if (it->Language() == Language::english)
|
||||
english = *it;
|
||||
}
|
||||
else if (mc.Language() == Language::english)
|
||||
english = mc;
|
||||
}
|
||||
if (!match.Str().empty())
|
||||
return match;
|
||||
@@ -353,8 +355,8 @@ namespace loot {
|
||||
vector<uint32_t> records = file->getFormIDs();
|
||||
vector<string> plugins = masters;
|
||||
plugins.push_back(name);
|
||||
for (vector<uint32_t>::const_iterator it = records.begin(),endIt = records.end(); it != endIt; ++it) {
|
||||
FormID fid = FormID(plugins, *it);
|
||||
for (const auto &record: records) {
|
||||
FormID fid = FormID(plugins, record);
|
||||
formIDs.insert(fid);
|
||||
if (!boost::iequals(fid.Plugin(), name))
|
||||
++numOverrideRecords;
|
||||
@@ -371,7 +373,7 @@ namespace loot {
|
||||
end = text.end();
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << name << ": " << "Attempting to read the version from the description.";
|
||||
for(int j = 0; j < 7 && version.empty(); j++) {
|
||||
for (int j = 0; j < 7 && version.empty(); j++) {
|
||||
smatch what;
|
||||
while (regex_search(begin, end, what, version_checks[j])) {
|
||||
if (what.empty())
|
||||
@@ -402,10 +404,10 @@ namespace loot {
|
||||
vector<string> bashTags;
|
||||
boost::split(bashTags, text, boost::is_any_of(","));
|
||||
|
||||
for (int i=0,max=bashTags.size(); i<max; ++i) {
|
||||
boost::trim(bashTags[i]);
|
||||
BOOST_LOG_TRIVIAL(trace) << name << ": " << "Extracted Bash Tag: " << bashTags[i];
|
||||
tags.insert(Tag(bashTags[i]));
|
||||
for (auto &tag: bashTags) {
|
||||
boost::trim(tag);
|
||||
BOOST_LOG_TRIVIAL(trace) << name << ": " << "Extracted Bash Tag: " << tag;
|
||||
tags.insert(Tag(tag));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,35 +574,35 @@ namespace loot {
|
||||
}
|
||||
|
||||
void Plugin::EvalAllConditions(loot::Game& game, const unsigned int language) {
|
||||
for (set<File>::iterator it = loadAfter.begin(); it != loadAfter.end();) {
|
||||
for (auto it = loadAfter.begin(); it != loadAfter.end();) {
|
||||
if (!it->EvalCondition(game))
|
||||
loadAfter.erase(it++);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
||||
for (set<File>::iterator it = requirements.begin(); it != requirements.end();) {
|
||||
for (auto it = requirements.begin(); it != requirements.end();) {
|
||||
if (!it->EvalCondition(game))
|
||||
requirements.erase(it++);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
||||
for (set<File>::iterator it = incompatibilities.begin(); it != incompatibilities.end();) {
|
||||
for (auto it = incompatibilities.begin(); it != incompatibilities.end();) {
|
||||
if (!it->EvalCondition(game))
|
||||
incompatibilities.erase(it++);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
||||
for (list<Message>::iterator it = messages.begin(); it != messages.end();) {
|
||||
for (auto it = messages.begin(); it != messages.end();) {
|
||||
if (!it->EvalCondition(game, language))
|
||||
it = messages.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
||||
for (set<Tag>::iterator it = tags.begin(); it != tags.end();) {
|
||||
for (auto it = tags.begin(); it != tags.end();) {
|
||||
if (!it->EvalCondition(game))
|
||||
tags.erase(it++);
|
||||
else
|
||||
@@ -621,7 +623,7 @@ namespace loot {
|
||||
} else
|
||||
_dirtyInfo.clear();
|
||||
|
||||
for (set<PluginDirtyInfo>::iterator it = _dirtyInfo.begin(); it != _dirtyInfo.end();) {
|
||||
for (auto it = _dirtyInfo.begin(); it != _dirtyInfo.end();) {
|
||||
if (it->CRC() != crc)
|
||||
_dirtyInfo.erase(it++);
|
||||
else
|
||||
@@ -691,9 +693,9 @@ namespace loot {
|
||||
|
||||
std::set<FormID> Plugin::OverrideFormIDs() const {
|
||||
set<FormID> fidSubset;
|
||||
for (set<FormID>::const_iterator it = formIDs.begin(), endIt=formIDs.end(); it != endIt; ++it) {
|
||||
if (!boost::iequals(it->Plugin(), name))
|
||||
fidSubset.insert(*it);
|
||||
for (const auto &formID : formIDs) {
|
||||
if (!boost::iequals(formID.Plugin(), name))
|
||||
fidSubset.insert(formID);
|
||||
}
|
||||
return fidSubset;
|
||||
}
|
||||
@@ -730,27 +732,27 @@ namespace loot {
|
||||
else
|
||||
messageType = loot::Message::warn;
|
||||
if (tags.find(Tag("Filter")) == tags.end()) {
|
||||
for (vector<string>::const_iterator it=masters.begin(), endIt=masters.end(); it != endIt; ++it) {
|
||||
if (!boost::filesystem::exists(game.DataPath() / *it) && !boost::filesystem::exists(game.DataPath() / (*it + ".ghost"))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << *it << "\", but it is missing.";
|
||||
messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % *it).str()));
|
||||
for (const auto &master: masters) {
|
||||
if (!boost::filesystem::exists(game.DataPath() / master) && !boost::filesystem::exists(game.DataPath() / (master + ".ghost"))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << master << "\", but it is missing.";
|
||||
messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % master).str()));
|
||||
}
|
||||
else if (!game.IsActive(*it)) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << *it << "\", but it is inactive.";
|
||||
messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be active, but it is inactive.")) % *it).str()));
|
||||
else if (!game.IsActive(master)) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << master << "\", but it is inactive.";
|
||||
messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be active, but it is inactive.")) % master).str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (set<File>::const_iterator it=requirements.begin(), endIt=requirements.end(); it != endIt; ++it) {
|
||||
if (!boost::filesystem::exists(game.DataPath() / it->Name()) && !(IsPlugin(it->Name()) && boost::filesystem::exists(game.DataPath() / (it->Name() + ".ghost")))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << it->Name() << "\", but it is missing.";
|
||||
messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % it->Name()).str()));
|
||||
for (const auto &req: requirements) {
|
||||
if (!boost::filesystem::exists(game.DataPath() / req.Name()) && !(IsPlugin(req.Name()) && boost::filesystem::exists(game.DataPath() / (req.Name() + ".ghost")))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" requires \"" << req.Name() << "\", but it is missing.";
|
||||
messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin requires \"%1%\" to be installed, but it is missing.")) % req.Name()).str()));
|
||||
}
|
||||
}
|
||||
for (set<File>::const_iterator it=incompatibilities.begin(), endIt=incompatibilities.end(); it != endIt; ++it) {
|
||||
if (boost::filesystem::exists(game.DataPath() / it->Name()) || (IsPlugin(it->Name()) && boost::filesystem::exists(game.DataPath() / (it->Name() + ".ghost")))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" is incompatible with \"" << it->Name() << "\", but both are present.";
|
||||
messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin is incompatible with \"%1%\", but both are present.")) % it->Name()).str()));
|
||||
for (const auto &inc: incompatibilities) {
|
||||
if (boost::filesystem::exists(game.DataPath() / inc.Name()) || (IsPlugin(inc.Name()) && boost::filesystem::exists(game.DataPath() / (inc.Name() + ".ghost")))) {
|
||||
BOOST_LOG_TRIVIAL(error) << "\"" << name << "\" is incompatible with \"" << inc.Name() << "\", but both are present.";
|
||||
messages.push_back(loot::Message(messageType, (boost::format(boost::locale::translate("This plugin is incompatible with \"%1%\", but both are present.")) % inc.Name()).str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,12 +324,12 @@ namespace loot {
|
||||
if (mlist["plugins"])
|
||||
plugins = mlist["plugins"].as< list<loot::Plugin> >();
|
||||
|
||||
for (list<loot::Plugin>::iterator it=plugins.begin(), endIt=plugins.end(); it != endIt; ++it) {
|
||||
it->EvalAllConditions(game, Language::any);
|
||||
for (auto &plugin: plugins) {
|
||||
plugin.EvalAllConditions(game, Language::any);
|
||||
}
|
||||
|
||||
for (list<loot::Message>::iterator it=messages.begin(), endIt=messages.end(); it != endIt; ++it) {
|
||||
it->EvalCondition(game, Language::any);
|
||||
for (auto &message: messages) {
|
||||
message.EvalCondition(game, Language::any);
|
||||
}
|
||||
|
||||
parsingFailed = false;
|
||||
|
||||
@@ -218,8 +218,8 @@ namespace YAML {
|
||||
//Check now that at least one item in content is English if there are multiple items.
|
||||
if (content.size() > 1) {
|
||||
bool found = false;
|
||||
for (std::vector<loot::MessageContent>::const_iterator it=content.begin(), endit=content.end(); it != endit; ++it) {
|
||||
if (it->Language() == loot::Language::english)
|
||||
for (const auto &mc: content) {
|
||||
if (mc.Language() == loot::Language::english)
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
@@ -296,8 +296,8 @@ namespace YAML {
|
||||
struct convert< std::set<T, Compare> > {
|
||||
static Node encode(const std::set<T, Compare>& rhs) {
|
||||
Node node;
|
||||
for (typename std::set<T, Compare>::const_iterator it=rhs.begin(), endIt=rhs.end(); it != endIt; ++it) {
|
||||
node.push_back(*it);
|
||||
for (const auto &element: rhs) {
|
||||
node.push_back(element);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@@ -307,8 +307,8 @@ namespace YAML {
|
||||
return false;
|
||||
|
||||
rhs.clear();
|
||||
for(YAML::const_iterator it=node.begin();it!=node.end();++it) {
|
||||
rhs.insert(it->as<T>());
|
||||
for (const auto &element : node) {
|
||||
rhs.insert(element.as<T>());
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -640,7 +640,7 @@ namespace loot {
|
||||
boost::split(components, path, boost::is_any_of("/\\"));
|
||||
components.pop_back();
|
||||
std::string parent_path;
|
||||
for (std::vector<std::string>::const_iterator it=components.begin(), endIt=components.end()--; it != endIt; ++it) {
|
||||
for (auto it=components.cbegin(), endIt=components.cend()--; it != endIt; ++it) {
|
||||
if (*it == ".")
|
||||
continue;
|
||||
parent_path += *it + '/';
|
||||
|
||||
+56
-56
@@ -246,17 +246,17 @@ MiniEditor::MiniEditor(wxWindow *parent, const wxString& title, const std::list<
|
||||
|
||||
//Fill pluginList with the contents of basePlugins.
|
||||
int i = 0;
|
||||
for (list<loot::Plugin>::const_iterator it = _basePlugins.begin(); it != _basePlugins.end(); ++it) {
|
||||
pluginList->InsertItem(i, FromUTF8(it->Name()));
|
||||
pluginList->SetItem(i, 1, FromUTF8(to_string(loot::modulo(it->Priority(), loot::max_priority))));
|
||||
if (abs(it->Priority()) >= loot::max_priority)
|
||||
for (const auto &plugin: _basePlugins) {
|
||||
pluginList->InsertItem(i, FromUTF8(plugin.Name()));
|
||||
pluginList->SetItem(i, 1, FromUTF8(to_string(loot::modulo(plugin.Priority(), loot::max_priority))));
|
||||
if (abs(plugin.Priority()) >= loot::max_priority)
|
||||
pluginList->SetItem(i, 2, FromUTF8("\xE2\x9C\x93"));
|
||||
else
|
||||
pluginList->SetItem(i, 2, FromUTF8("\xE2\x9C\x97"));
|
||||
if (it->FormIDs().empty()) {
|
||||
if (plugin.FormIDs().empty()) {
|
||||
pluginList->SetItemTextColour(i, wxColour(122, 122, 122));
|
||||
}
|
||||
else if (it->LoadsBSA(_game)) {
|
||||
else if (plugin.LoadsBSA(_game)) {
|
||||
pluginList->SetItemTextColour(i, wxColour(0, 142, 219));
|
||||
}
|
||||
++i;
|
||||
@@ -311,8 +311,8 @@ void MiniEditor::OnPluginSelect(wxListEvent& event) {
|
||||
loadAfterList->DeleteAllItems();
|
||||
set<loot::File> files = plugin.LoadAfter();
|
||||
int i = 0;
|
||||
for (set<loot::File>::const_iterator it = files.begin(), endit = files.end(); it != endit; ++it) {
|
||||
loadAfterList->InsertItem(i, FromUTF8(it->Name()));
|
||||
for (const auto &file: files) {
|
||||
loadAfterList->InsertItem(i, FromUTF8(file.Name()));
|
||||
++i;
|
||||
}
|
||||
if (loadAfterList->GetItemCount() == 0)
|
||||
@@ -355,9 +355,9 @@ void MiniEditor::OnFilterToggle(wxCommandEvent& event) {
|
||||
//First need to merge the base and edited plugin lists so that the right priority values get displayed.
|
||||
|
||||
list<loot::Plugin> plugins(_basePlugins);
|
||||
for (list<loot::Plugin>::const_iterator it = _editedPlugins.begin(); it != _editedPlugins.end(); ++it) {
|
||||
list<loot::Plugin>::iterator pos = std::find(plugins.begin(), plugins.end(), *it);
|
||||
pos->MergeMetadata(*it);
|
||||
for (const auto &plugin: _editedPlugins) {
|
||||
list<loot::Plugin>::iterator pos = std::find(plugins.begin(), plugins.end(), plugin);
|
||||
pos->MergeMetadata(plugin);
|
||||
}
|
||||
|
||||
//Disable list selection.
|
||||
@@ -377,19 +377,19 @@ void MiniEditor::OnFilterToggle(wxCommandEvent& event) {
|
||||
bool loadsBSA = pos->LoadsBSA(_game);
|
||||
|
||||
int i = 0;
|
||||
for (list<loot::Plugin>::const_iterator it = plugins.begin(); it != plugins.end(); ++it) {
|
||||
for (const auto &plugin: plugins) {
|
||||
//Want to filter to show only those the selected plugin can load after validly, and which also either conflict with it,
|
||||
//or which load a BSA (if the selected plugin loads a BSA).
|
||||
if (*it == *pos || !it->MustLoadAfter(*pos) && (pos->DoFormIDsOverlap(*it) || (loadsBSA && it->LoadsBSA(_game)))) {
|
||||
pluginList->InsertItem(i, FromUTF8(it->Name()));
|
||||
pluginList->SetItem(i, 1, FromUTF8(to_string(it->Priority())));
|
||||
if (it->FormIDs().empty()) {
|
||||
if (plugin == *pos || !plugin.MustLoadAfter(*pos) && (pos->DoFormIDsOverlap(plugin) || (loadsBSA && plugin.LoadsBSA(_game)))) {
|
||||
pluginList->InsertItem(i, FromUTF8(plugin.Name()));
|
||||
pluginList->SetItem(i, 1, FromUTF8(to_string(plugin.Priority())));
|
||||
if (plugin.FormIDs().empty()) {
|
||||
pluginList->SetItemTextColour(i, wxColour(122, 122, 122));
|
||||
}
|
||||
else if (it->LoadsBSA(_game)) {
|
||||
else if (plugin.LoadsBSA(_game)) {
|
||||
pluginList->SetItemTextColour(i, wxColour(0, 142, 219));
|
||||
}
|
||||
if (std::find(_editedPlugins.begin(), _editedPlugins.end(), *it) != _editedPlugins.end()) {
|
||||
if (std::find(_editedPlugins.begin(), _editedPlugins.end(), plugin) != _editedPlugins.end()) {
|
||||
pluginList->SetItemFont(i, wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold());
|
||||
}
|
||||
++i;
|
||||
@@ -400,16 +400,16 @@ void MiniEditor::OnFilterToggle(wxCommandEvent& event) {
|
||||
else {
|
||||
pluginList->DeleteAllItems();
|
||||
int i = 0;
|
||||
for (list<loot::Plugin>::const_iterator it = plugins.begin(); it != plugins.end(); ++it) {
|
||||
pluginList->InsertItem(i, FromUTF8(it->Name()));
|
||||
pluginList->SetItem(i, 1, FromUTF8(to_string(it->Priority())));
|
||||
if (it->FormIDs().empty()) {
|
||||
for (const auto &plugin: plugins) {
|
||||
pluginList->InsertItem(i, FromUTF8(plugin.Name()));
|
||||
pluginList->SetItem(i, 1, FromUTF8(to_string(plugin.Priority())));
|
||||
if (plugin.FormIDs().empty()) {
|
||||
pluginList->SetItemTextColour(i, wxColour(122, 122, 122));
|
||||
}
|
||||
else if (it->LoadsBSA(_game)) {
|
||||
else if (plugin.LoadsBSA(_game)) {
|
||||
pluginList->SetItemTextColour(i, wxColour(0, 142, 219));
|
||||
}
|
||||
if (std::find(_editedPlugins.begin(), _editedPlugins.end(), *it) != _editedPlugins.end()) {
|
||||
if (std::find(_editedPlugins.begin(), _editedPlugins.end(), plugin) != _editedPlugins.end()) {
|
||||
pluginList->SetItemFont(i, wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold());
|
||||
}
|
||||
++i;
|
||||
@@ -695,8 +695,8 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli
|
||||
|
||||
//Fill pluginList with the contents of basePlugins.
|
||||
int i = 0;
|
||||
for (list<loot::Plugin>::const_iterator it = _basePlugins.begin(); it != _basePlugins.end(); ++it) {
|
||||
AddPluginToList(*it, i);
|
||||
for (const auto &plugin: _basePlugins) {
|
||||
AddPluginToList(plugin, i);
|
||||
++i;
|
||||
}
|
||||
pluginList->SetColumnWidth(0, wxLIST_AUTOSIZE);
|
||||
@@ -765,10 +765,10 @@ void Editor::OnPluginSelect(wxListEvent& event) {
|
||||
|
||||
set<loot::File> files = plugin.LoadAfter();
|
||||
int i=0;
|
||||
for (set<loot::File>::const_iterator it=files.begin(), endit=files.end(); it != endit; ++it) {
|
||||
loadAfterList->InsertItem(i, FromUTF8(it->Name()));
|
||||
loadAfterList->SetItem(i, 1, FromUTF8(it->DisplayName()));
|
||||
loadAfterList->SetItem(i, 2, FromUTF8(it->Condition()));
|
||||
for (const auto &file: files) {
|
||||
loadAfterList->InsertItem(i, FromUTF8(file.Name()));
|
||||
loadAfterList->SetItem(i, 1, FromUTF8(file.DisplayName()));
|
||||
loadAfterList->SetItem(i, 2, FromUTF8(file.Condition()));
|
||||
++i;
|
||||
}
|
||||
if (loadAfterList->GetItemCount() == 0)
|
||||
@@ -778,10 +778,10 @@ void Editor::OnPluginSelect(wxListEvent& event) {
|
||||
|
||||
files = plugin.Reqs();
|
||||
i=0;
|
||||
for (set<loot::File>::const_iterator it=files.begin(), endit=files.end(); it != endit; ++it) {
|
||||
reqsList->InsertItem(i, FromUTF8(it->Name()));
|
||||
reqsList->SetItem(i, 1, FromUTF8(it->DisplayName()));
|
||||
reqsList->SetItem(i, 2, FromUTF8(it->Condition()));
|
||||
for (const auto &file : files) {
|
||||
reqsList->InsertItem(i, FromUTF8(file.Name()));
|
||||
reqsList->SetItem(i, 1, FromUTF8(file.DisplayName()));
|
||||
reqsList->SetItem(i, 2, FromUTF8(file.Condition()));
|
||||
++i;
|
||||
}
|
||||
if (reqsList->GetItemCount() == 0)
|
||||
@@ -791,10 +791,10 @@ void Editor::OnPluginSelect(wxListEvent& event) {
|
||||
|
||||
files = plugin.Incs();
|
||||
i=0;
|
||||
for (set<loot::File>::const_iterator it=files.begin(), endit=files.end(); it != endit; ++it) {
|
||||
incsList->InsertItem(i, FromUTF8(it->Name()));
|
||||
incsList->SetItem(i, 1, FromUTF8(it->DisplayName()));
|
||||
incsList->SetItem(i, 2, FromUTF8(it->Condition()));
|
||||
for (const auto &file : files) {
|
||||
incsList->InsertItem(i, FromUTF8(file.Name()));
|
||||
incsList->SetItem(i, 1, FromUTF8(file.DisplayName()));
|
||||
incsList->SetItem(i, 2, FromUTF8(file.Condition()));
|
||||
++i;
|
||||
}
|
||||
if (incsList->GetItemCount() == 0)
|
||||
@@ -808,13 +808,13 @@ void Editor::OnPluginSelect(wxListEvent& event) {
|
||||
|
||||
set<loot::Tag> tags = plugin.Tags();
|
||||
i=0;
|
||||
for (set<loot::Tag>::const_iterator it=tags.begin(), endit=tags.end(); it != endit; ++it) {
|
||||
if (it->IsAddition())
|
||||
for (const auto &tag: tags) {
|
||||
if (tag.IsAddition())
|
||||
tagsList->InsertItem(i, State[0]);
|
||||
else
|
||||
tagsList->InsertItem(i, State[1]);
|
||||
tagsList->SetItem(i, 1, FromUTF8(it->Name()));
|
||||
tagsList->SetItem(i, 2, FromUTF8(it->Condition()));
|
||||
tagsList->SetItem(i, 1, FromUTF8(tag.Name()));
|
||||
tagsList->SetItem(i, 2, FromUTF8(tag.Condition()));
|
||||
++i;
|
||||
}
|
||||
if (tagsList->GetItemCount() == 0)
|
||||
@@ -824,12 +824,12 @@ void Editor::OnPluginSelect(wxListEvent& event) {
|
||||
|
||||
set<loot::PluginDirtyInfo> dirtyInfo = plugin.DirtyInfo();
|
||||
i=0;
|
||||
for (set<loot::PluginDirtyInfo>::const_iterator it=dirtyInfo.begin(), endit=dirtyInfo.end(); it != endit; ++it) {
|
||||
dirtyList->InsertItem(i, FromUTF8(loot::IntToHexString(it->CRC())));
|
||||
dirtyList->SetItem(i, 1, FromUTF8(to_string(it->ITMs())));
|
||||
dirtyList->SetItem(i, 2, FromUTF8(to_string(it->UDRs())));
|
||||
dirtyList->SetItem(i, 3, FromUTF8(to_string(it->DeletedNavmeshes())));
|
||||
dirtyList->SetItem(i, 4, FromUTF8(it->CleaningUtility()));
|
||||
for (const auto &element: dirtyInfo) {
|
||||
dirtyList->InsertItem(i, FromUTF8(loot::IntToHexString(element.CRC())));
|
||||
dirtyList->SetItem(i, 1, FromUTF8(to_string(element.ITMs())));
|
||||
dirtyList->SetItem(i, 2, FromUTF8(to_string(element.UDRs())));
|
||||
dirtyList->SetItem(i, 3, FromUTF8(to_string(element.DeletedNavmeshes())));
|
||||
dirtyList->SetItem(i, 4, FromUTF8(element.CleaningUtility()));
|
||||
++i;
|
||||
}
|
||||
if (dirtyList->GetItemCount() == 0)
|
||||
@@ -1392,9 +1392,9 @@ void Editor::OnFilterToggle(wxCommandEvent& event) {
|
||||
//First need to merge the base and edited plugin lists so that the right priority values get displayed.
|
||||
|
||||
list<loot::Plugin> plugins(_basePlugins);
|
||||
for (list<loot::Plugin>::const_iterator it = _editedPlugins.begin(); it != _editedPlugins.end(); ++it) {
|
||||
list<loot::Plugin>::iterator pos = std::find(plugins.begin(), plugins.end(), *it);
|
||||
pos->MergeMetadata(*it);
|
||||
for (const auto &plugin: _editedPlugins) {
|
||||
list<loot::Plugin>::iterator pos = std::find(plugins.begin(), plugins.end(), plugin);
|
||||
pos->MergeMetadata(plugin);
|
||||
}
|
||||
|
||||
//Disable list selection.
|
||||
@@ -1414,11 +1414,11 @@ void Editor::OnFilterToggle(wxCommandEvent& event) {
|
||||
bool loadsBSA = pos->LoadsBSA(_game);
|
||||
|
||||
int i = 0;
|
||||
for (list<loot::Plugin>::const_iterator it = plugins.begin(); it != plugins.end(); ++it) {
|
||||
for (const auto &plugin: plugins) {
|
||||
//Want to filter to show only those the selected plugin can load after validly, and which also either conflict with it,
|
||||
//or which load a BSA (if the selected plugin loads a BSA).
|
||||
if (*it == *pos || !it->MustLoadAfter(*pos) && (pos->DoFormIDsOverlap(*it) || (loadsBSA && it->LoadsBSA(_game)))) {
|
||||
AddPluginToList(*it, i);
|
||||
if (plugin == *pos || !plugin.MustLoadAfter(*pos) && (pos->DoFormIDsOverlap(plugin) || (loadsBSA && plugin.LoadsBSA(_game)))) {
|
||||
AddPluginToList(plugin, i);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -1427,8 +1427,8 @@ void Editor::OnFilterToggle(wxCommandEvent& event) {
|
||||
else {
|
||||
pluginList->DeleteAllItems();
|
||||
int i = 0;
|
||||
for (list<loot::Plugin>::const_iterator it = plugins.begin(); it != plugins.end(); ++it) {
|
||||
AddPluginToList(*it, i);
|
||||
for (const auto &plugin: plugins) {
|
||||
AddPluginToList(plugin, i);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
+25
-25
@@ -691,14 +691,14 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
|
||||
//Now load plugins.
|
||||
plugin_list_loader pll(graph, *_game);
|
||||
for (boost::unordered_map<string, size_t>::const_iterator it=tempMap.begin(), endit=tempMap.end(); it != endit; ++it) {
|
||||
for (const auto &pluginPair: tempMap) {
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Found plugin: " << it->first;
|
||||
BOOST_LOG_TRIVIAL(info) << "Found plugin: " << pluginPair.first;
|
||||
|
||||
vertex_t v = boost::add_vertex(loot::Plugin(it->first), graph);
|
||||
vertex_t v = boost::add_vertex(loot::Plugin(pluginPair.first), graph);
|
||||
|
||||
if (it->second > meanFileSize) {
|
||||
pll.skipPlugins.insert(it->first);
|
||||
if (pluginPair.second > meanFileSize) {
|
||||
pll.skipPlugins.insert(pluginPair.first);
|
||||
plugin_loader pl(graph[v], *_game);
|
||||
group.create_thread(pl);
|
||||
}
|
||||
@@ -833,9 +833,9 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Building the plugin dependency graph...";
|
||||
|
||||
//Now add the interactions between plugins to the graph as edges.
|
||||
std::map<std::string, int> overridenPriorities;
|
||||
std::map<std::string, int> overriddenPriorities;
|
||||
BOOST_LOG_TRIVIAL(debug) << "Adding non-overlap edges.";
|
||||
AddSpecificEdges(graph, overridenPriorities);
|
||||
AddSpecificEdges(graph, overriddenPriorities);
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Adding priority edges.";
|
||||
AddPriorityEdges(graph);
|
||||
@@ -846,10 +846,10 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Checking to see if the graph is cyclic.";
|
||||
loot::CheckForCycles(graph);
|
||||
|
||||
for (std::map<std::string, int>::const_iterator it = overridenPriorities.begin(), itend = overridenPriorities.end(); it != itend; ++it) {
|
||||
for (const auto &overriddenPriority: overriddenPriorities) {
|
||||
vertex_t vertex;
|
||||
if (loot::GetVertexByName(graph, it->first, vertex)) {
|
||||
graph[vertex].Priority(it->second);
|
||||
if (loot::GetVertexByName(graph, overriddenPriority.first, vertex)) {
|
||||
graph[vertex].Priority(overriddenPriority.second);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -899,14 +899,14 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
|
||||
//Merge edits down to the userlist entries.
|
||||
BOOST_LOG_TRIVIAL(debug) << "Merging down edits to the userlist.";
|
||||
for (list<loot::Plugin>::const_iterator it = edits.begin(), endit = edits.end(); it != endit; ++it) {
|
||||
list<loot::Plugin>::iterator jt = find(ulist_plugins.begin(), ulist_plugins.end(), *it);
|
||||
for (const auto &plugin: edits) {
|
||||
auto it = find(ulist_plugins.begin(), ulist_plugins.end(), plugin);
|
||||
|
||||
if (jt != ulist_plugins.end()) {
|
||||
jt->MergeMetadata(*it);
|
||||
if (it != ulist_plugins.end()) {
|
||||
it->MergeMetadata(plugin);
|
||||
}
|
||||
else {
|
||||
ulist_plugins.push_back(*it);
|
||||
ulist_plugins.push_back(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -937,8 +937,8 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
messages.push_back(loot::Message(loot::Message::error, (format(loc::translate("Failed to set the load order. Details: %1%")) % e.what()).str()));
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "Load order set:";
|
||||
for (list<loot::Plugin>::iterator it = plugins.begin(), endIt = plugins.end(); it != endIt; ++it) {
|
||||
BOOST_LOG_TRIVIAL(info) << '\t' << it->Name();
|
||||
for (const auto &plugin: plugins) {
|
||||
BOOST_LOG_TRIVIAL(info) << '\t' << plugin.Name();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1002,8 +1002,8 @@ void Launcher::OnEditMetadata(wxCommandEvent& event) {
|
||||
//Sort plugins into their load order.
|
||||
list<string> loadOrder;
|
||||
_game->GetLoadOrder(loadOrder);
|
||||
for (list<string>::const_iterator it = loadOrder.begin(), itend = loadOrder.end(); it != itend; ++it) {
|
||||
unordered_map<string, loot::Plugin>::const_iterator pos = _game->plugins.find(*it);
|
||||
for (const auto &pluginName: loadOrder) {
|
||||
const auto pos = _game->plugins.find(pluginName);
|
||||
|
||||
if (pos != _game->plugins.end())
|
||||
installed.push_back(pos->second);
|
||||
@@ -1055,20 +1055,20 @@ void Launcher::OnEditMetadata(wxCommandEvent& event) {
|
||||
|
||||
//Merge the masterlist down into the installed mods list.
|
||||
BOOST_LOG_TRIVIAL(debug) << "Merging the masterlist down into the installed mods list.";
|
||||
for (list<loot::Plugin>::const_iterator it = mlist_plugins.begin(), endit = mlist_plugins.end(); it != endit; ++it) {
|
||||
list<loot::Plugin>::iterator pos = find(installed.begin(), installed.end(), *it);
|
||||
for (const auto &plugin: mlist_plugins) {
|
||||
auto pos = find(installed.begin(), installed.end(), plugin);
|
||||
|
||||
if (pos != installed.end())
|
||||
pos->MergeMetadata(*it);
|
||||
pos->MergeMetadata(plugin);
|
||||
}
|
||||
|
||||
progDia->Pulse();
|
||||
|
||||
//Add empty entries for any userlist entries that aren't installed.
|
||||
BOOST_LOG_TRIVIAL(debug) << "Padding the installed mods list to match the plugins in the userlist.";
|
||||
for (list<loot::Plugin>::const_iterator it = ulist_plugins.begin(), endit = ulist_plugins.end(); it != endit; ++it) {
|
||||
if (find(installed.begin(), installed.end(), *it) == installed.end())
|
||||
installed.push_back(loot::Plugin(it->Name()));
|
||||
for (const auto &plugin : ulist_plugins) {
|
||||
if (find(installed.begin(), installed.end(), plugin) == installed.end())
|
||||
installed.push_back(loot::Plugin(plugin.Name()));
|
||||
}
|
||||
|
||||
progDia->Pulse();
|
||||
|
||||
Reference in New Issue
Block a user