From 98073c355e9406ff3a2730da7dd25cffad71f965 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 14 Jul 2014 10:30:33 +0100 Subject: [PATCH] Fixed masterlist and userlist messages not shown. It's a bit messy, ideally I'd like to have the graph store pointers or references to the temporary plugin lists's contents. --- src/backend/graph.cpp | 10 +++++++--- src/gui/main.cpp | 22 +++++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/backend/graph.cpp b/src/backend/graph.cpp index bd9f49ec..08627e48 100644 --- a/src/backend/graph.cpp +++ b/src/backend/graph.cpp @@ -105,15 +105,18 @@ namespace loot { std::list sortedVertices; boost::topological_sort(graph, std::front_inserter(sortedVertices), boost::vertex_index_map(v_index_map)); + /* Sorting now evaluates conditions inside the graph, so existing plugins list is missing + data present in the graph, so we need to swap the two lists. */ BOOST_LOG_TRIVIAL(info) << "Calculated order: "; - list tempPlugins; + plugins.clear(); for (const auto &vertex: sortedVertices) { BOOST_LOG_TRIVIAL(info) << '\t' << graph[vertex].Name(); - tempPlugins.push_back(graph[vertex].Name()); + plugins.push_back(graph[vertex]); } + //Now sort exist plugins list according to order in tempPlugins. - plugins.sort([tempPlugins](const Plugin& first, const Plugin& second){ + /*plugins.sort([tempPlugins](const Plugin& first, const Plugin& second){ //Find both plugins, and compare distances from beginning. auto fIt = find(tempPlugins.begin(), tempPlugins.end(), first); auto sIt = find(tempPlugins.begin(), tempPlugins.end(), second); @@ -123,6 +126,7 @@ namespace loot { return distance(tempPlugins.begin(), fIt) < distance(tempPlugins.begin(), sIt); }); + */ } void CheckForCycles(const PluginGraph& graph) { diff --git a/src/gui/main.cpp b/src/gui/main.cpp index da23ae3e..1b4d6f1d 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -698,6 +698,18 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { list plugins; for (auto &plugin : _game->plugins) { plugins.push_back(plugin.second); + + // Merge the masterlist data down into the plugins now, as userlist changes won't affect + // it. + BOOST_LOG_TRIVIAL(trace) << "Merging for plugin \"" << plugins.back().Name() << "\""; + + //Check if there is a plugin entry in the masterlist. This will also find matching regex entries. + list::iterator pos = std::find(_game->masterlist.plugins.begin(), _game->masterlist.plugins.end(), plugins.back()); + + if (pos != _game->masterlist.plugins.end()) { + BOOST_LOG_TRIVIAL(trace) << "Merging masterlist data down to plugin list data."; + plugins.back().MergeMetadata(*pos); + } } try { bool applyLoadOrder = false; @@ -714,16 +726,8 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { for (boost::tie(vit, vitend) = boost::vertices(graph); vit != vitend; ++vit) { BOOST_LOG_TRIVIAL(trace) << "Merging for plugin \"" << graph[*vit].Name() << "\""; - //Check if there is a plugin entry in the masterlist. This will also find matching regex entries. - list::iterator pos = std::find(_game->masterlist.plugins.begin(), _game->masterlist.plugins.end(), graph[*vit]); - - if (pos != _game->masterlist.plugins.end()) { - BOOST_LOG_TRIVIAL(trace) << "Merging masterlist data down to plugin list data."; - graph[*vit].MergeMetadata(*pos); - } - //Check if there is a plugin entry in the userlist. This will also find matching regex entries. - pos = std::find(_game->userlist.plugins.begin(), _game->userlist.plugins.end(), graph[*vit]); + list::iterator pos = std::find(_game->userlist.plugins.begin(), _game->userlist.plugins.end(), graph[*vit]); if (pos != _game->userlist.plugins.end() && pos->Enabled()) { BOOST_LOG_TRIVIAL(trace) << "Merging userlist data down to plugin list data.";