Some tidying up of graph code.

This commit is contained in:
WrinklyNinja
2014-02-18 09:14:19 +00:00
parent dc17abb41b
commit 0c1cbe01c5
+18 -12
View File
@@ -110,10 +110,12 @@ namespace boss {
boss::vertex_it vit2 = vit;
++vit2;
for (vit2,vitend; vit2 != vitend; ++vit2) {
while (vit2 != vitend) {
if (graph[*vit].IsMaster() == graph[*vit2].IsMaster())
if (graph[*vit].IsMaster() == graph[*vit2].IsMaster()) {
++vit2;
continue;
}
vertex_t vertex, parentVertex;
if (graph[*vit2].IsMaster()) {
@@ -130,6 +132,7 @@ namespace boss {
boost::add_edge(parentVertex, vertex, graph);
}
++vit2;
}
BOOST_LOG_TRIVIAL(trace) << "Adding in-edges for masters.";
@@ -180,10 +183,12 @@ namespace boss {
BOOST_LOG_TRIVIAL(trace) << "Adding priority difference edges to vertex for \"" << graph[*vit].Name() << "\".";
boss::vertex_it vit2 = vit;
++vit2;
for (vit2,vitend; vit2 != vitend; ++vit2) {
while (vit2 != vitend) {
BOOST_LOG_TRIVIAL(trace) << "Checking for priority difference between \"" << graph[*vit].Name() << "\" and \"" << graph[*vit2].Name() << "\".";
if (graph[*vit].Priority() == graph[*vit2].Priority())
if (graph[*vit].Priority() == graph[*vit2].Priority()) {
++vit2;
continue;
}
vertex_t vertex, parentVertex;
if (graph[*vit].Priority() < graph[*vit2].Priority()) {
@@ -201,6 +206,7 @@ namespace boss {
boost::add_edge(parentVertex, vertex, graph);
}
++vit2;
}
}
}
@@ -209,20 +215,19 @@ namespace boss {
boss::vertex_it vit, vitend;
for (boost::tie(vit, vitend) = boost::vertices(graph); vit != vitend; ++vit) {
vertex_t parentVertex;
BOOST_LOG_TRIVIAL(trace) << "Adding overlap edges to vertex for \"" << graph[*vit].Name() << "\".";
if (graph[*vit].NumOverrideFormIDs() == 0) {
continue;
}
boss::vertex_it vit2 = vit;
++vit2;
for (vit2,vitend; vit2 != vitend; ++vit2) {
BOOST_LOG_TRIVIAL(trace) << "Checking for FormID overlap between \"" << graph[*vit].Name() << "\" and \"" << graph[*vit2].Name() << "\".";
if (graph[*vit].DoFormIDsOverlap(graph[*vit2])) {
if (graph[*vit].MustLoadAfter(graph[*vit2]) || graph[*vit2].MustLoadAfter(graph[*vit]) || graph[*vit].Priority() != graph[*vit2].Priority())
continue;
while (vit2 != vitend) {
BOOST_LOG_TRIVIAL(trace) << "Checking edge validity between \"" << graph[*vit].Name() << "\" and \"" << graph[*vit2].Name() << "\".";
if (graph[*vit].Priority() == graph[*vit2].Priority() && !graph[*vit].MustLoadAfter(graph[*vit2]) && !graph[*vit2].MustLoadAfter(graph[*vit]) && graph[*vit].DoFormIDsOverlap(graph[*vit2])) {
vertex_t vertex, parentVertex;
if (graph[*vit].NumOverrideFormIDs() > graph[*vit2].NumOverrideFormIDs()) {
parentVertex = *vit;
@@ -249,6 +254,7 @@ namespace boss {
boost::add_edge(parentVertex, vertex, graph);
}
}
++vit2;
}
}
}