Vertices have already been created, and linked to their respective Waypoints.
All of this could be replaced with a simple if (p->vertex), but first Waypoint::vertexmust be 0ed on construction; right now it's uninitialized until vertex setup.
Side benefit: if any future changes use the initial value of non-vertex Waypoints, dereferencing a null pointer rather than reading/writing thru a garbage pointer should be easier to debug.
If the writes to every Waypoint are actually less efficient, we can get rid of the extraneous colocation check in is_or_colocated_with_active_or_preview by using a lambda:
// first check if this is a terminal quadrant, and if it is,
// we search for vertices within this quadrant
if (!qt->refined())
for (Waypoint *p : qt->points)
{ auto graph_point = [=]()
{ if (!p->colocated) return p->route->system->active_or_preview();
if (p != p->colocated->front()) return false;
for (Waypoint* w : *p->colocated)
if (w->route->system->active_or_preview()) return true;
return false;
};
if ( graph_point()
&& contains_vertex(p->lat, p->lng)
&& p->region_match(gle.regions)
&& p->system_match(gle.systems)
){ vvec.push_back(p->vertex);
hg->add_to_subgraph(p->vertex, threadnum);
}
}
https://github.com/yakra/DataProcessing/blob/387c99b0c260938c870457bb9793d4f78b09987f/siteupdate/cplusplus/classes/GraphGeneration/PlaceRadius.cpp#L91-L92
Either...
if (p->vertex)
, but firstWaypoint::vertex
must be 0ed on construction; right now it's uninitialized until vertex setup. Side benefit: if any future changes use the initial value of non-vertex Waypoints, dereferencing a null pointer rather than reading/writing thru a garbage pointer should be easier to debug.is_or_colocated_with_active_or_preview
by using a lambda: