Check that toposort result is Hamiltonian.

It should be, but don't stop people from sorting if it's not for
whatever reason.
This commit is contained in:
Oliver Hamlet
2015-04-29 14:04:52 +01:00
parent f85f5504d6
commit f924bcfbf5
+8
View File
@@ -373,6 +373,14 @@ namespace loot {
list<vertex_t> sortedVertices;
boost::topological_sort(graph, std::front_inserter(sortedVertices), boost::vertex_index_map(v_index_map));
// Check that the sorted path is Hamiltonian (ie. unique).
for (auto it = sortedVertices.begin(); it != sortedVertices.end(); ++it) {
if (next(it) != sortedVertices.end() && !boost::edge(*it, *next(it), graph).second) {
BOOST_LOG_TRIVIAL(error) << "The calculated load order is not unique. No edge exists between"
<< graph[*it].Name() << " and " << graph[*next(it)].Name() << ".";
}
}
// Output a plugin list using the sorted vertices.
BOOST_LOG_TRIVIAL(info) << "Calculated order: ";
list<Plugin> plugins;