| boolWaypoint::is_or_colocated_with_active_or_preview() |
| { if (route->system->active_or_preview()) return1; |
| if (colocated) |
| for (Waypoint *w : *colocated) |
| if (w->route->system->active_or_preview()) return1; |
| return0; |
| } |
The following alternative has advantages for devel points...
boolWaypoint::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()) return1;
return0;
}...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.
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. ;)
DataProcessing/siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp
Lines 172 to 178 in 387c99b
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 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
colocatedcheck 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. ;)
This proposes a lambda for
WaypointQuadtree::graph_points.We can either use a slightly different lambda, or just check if
p->vertex == 0, whatever performs better.