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.
This commit is contained in:
WrinklyNinja
2014-07-14 10:30:33 +01:00
parent 5aa4646ce6
commit 98073c355e
2 changed files with 20 additions and 12 deletions
+7 -3
View File
@@ -105,15 +105,18 @@ namespace loot {
std::list<vertex_t> 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<string> 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) {
+13 -9
View File
@@ -698,6 +698,18 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
list<loot::Plugin> 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<loot::Plugin>::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<loot::Plugin>::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<loot::Plugin>::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.";