- waypoints.erase(waypoints.begin());
- metrics_stale = true;
- signal_waypoint_reached.emit(&wp);
- signal_event.emit(Message("waypoint-reached", &wp));
+ if(wp.direction!=TrackChain::UNSPECIFIED)
+ if(t_iter!=wp.chain->iter_for(*t_iter, wp.direction))
+ break;
+
+ if(waypoints.size()==1)
+ {
+ if(state==RESERVED_TO_END)
+ state = ADVANCED_TO_END;
+ }
+ else
+ {
+ const TrackChain *chain = wp.chain;
+ waypoints.erase(waypoints.begin());
+ metrics_stale = true;
+ signal_waypoint_reached.emit(chain);
+ signal_event.emit(Message("waypoint-reached", chain));
+ }