The following alternative has advantages for devel points...
bool Waypoint::is_or_colocated_with_active_or_preview()
{ if (!colocated) return route->system->active_or_preview();
for (Waypoint *w : *colocated)
if (w->route->system->active_or_preview()) return 1;
return 0;
}
...and disadvantages for a/p points, of which there are more.
More to the point, its 2 usecases differ a bit in context, but both first check whether a point is singleton or at the front of its colocation list. Meaning, the colocated check here is redundant.
Rather than remove the check & leave us with a function that could defy developer expectations & cause wacky antics if ever called on a singleton point, let's remove the function call overhead altogether. ;)
[ ] #275
This proposes a lambda for WaypointQuadtree::graph_points.
[ ] #276
We can either use a slightly different lambda, or just check if p->vertex == 0, whatever performs better.
https://github.com/yakra/DataProcessing/blob/387c99b0c260938c870457bb9793d4f78b09987f/siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp#L172-L178
The following alternative has advantages for devel points...
...and disadvantages for a/p points, of which there are more.
More to the point, its 2 use cases differ a bit in context, but both first check whether a point is singleton or at the front of its colocation list. Meaning, the
colocated
check here is redundant.Edit: Potential new use case
Rather than remove the check & leave us with a function that could defy developer expectations & cause wacky antics if ever called on a singleton point, let's remove the function call overhead altogether. ;)
WaypointQuadtree::graph_points
.p->vertex == 0
, whatever performs better.