diff --git a/src/backend/graph.cpp b/src/backend/graph.cpp index 11448642..ef82b90b 100644 --- a/src/backend/graph.cpp +++ b/src/backend/graph.cpp @@ -117,7 +117,7 @@ namespace loot { boost::depth_first_search(graph, visitor(vis).vertex_index_map(v_index_map)); } - void AddSpecificEdges(PluginGraph& graph) { + void AddSpecificEdges(PluginGraph& graph, std::map& overridenPriorities) { //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) { @@ -209,8 +209,11 @@ namespace loot { //parentPriority is now the highest priority value of any plugin that the current plugin needs to load after. //Set the current plugin's priority to parentPlugin. - if (graph[*vit].Priority() < parentPriority) + 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(graph[*vit].Name(), graph[*vit].Priority())); graph[*vit].Priority(parentPriority); + } } } diff --git a/src/backend/graph.h b/src/backend/graph.h index faad4781..16f27db7 100644 --- a/src/backend/graph.h +++ b/src/backend/graph.h @@ -57,7 +57,7 @@ namespace loot { void CheckForCycles(const PluginGraph& graph); - void AddSpecificEdges(PluginGraph& graph); + void AddSpecificEdges(PluginGraph& graph, std::map& overridenPriorities); void AddPriorityEdges(PluginGraph& graph); diff --git a/src/gui/main.cpp b/src/gui/main.cpp index a7898acd..88f1b149 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -833,8 +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 overridenPriorities; BOOST_LOG_TRIVIAL(debug) << "Adding non-overlap edges."; - AddSpecificEdges(graph); + AddSpecificEdges(graph, overridenPriorities); BOOST_LOG_TRIVIAL(debug) << "Adding priority edges."; AddPriorityEdges(graph); @@ -845,6 +846,13 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { BOOST_LOG_TRIVIAL(info) << "Checking to see if the graph is cyclic."; loot::CheckForCycles(graph); + for (std::map::const_iterator it = overridenPriorities.begin(), itend = overridenPriorities.end(); it != itend; ++it) { + vertex_t vertex; + if (loot::GetVertexByName(graph, it->first, vertex)) { + graph[vertex].Priority(it->second); + } + } + progDia->Pulse(); BOOST_LOG_TRIVIAL(info) << "Performing a topological sort.";