Skip to content

Waypoint::is_or_colocated_with_active_or_preview #277

@yakra

Description

@yakra

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. ;)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions