forked from TravelMapping/DataProcessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
DataProcessing/siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp
Lines 172 to 178 in 387c99b
| bool Waypoint::is_or_colocated_with_active_or_preview() | |
| { if (route->system->active_or_preview()) return 1; | |
| if (colocated) | |
| for (Waypoint *w : *colocated) | |
| if (w->route->system->active_or_preview()) return 1; | |
| return 0; | |
| } |
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 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. ;)
- optimizing vertex creation order #275
This proposes a lambda forWaypointQuadtree::graph_points. - area graph vertex membership #276
We can either use a slightly different lambda, or just check ifp->vertex == 0, whatever performs better.