This allows delegates to take action when the flightlan is cleared, and especially, for the default delegate in the route-manager to deactivate itself, and hence the GPS LEG mode - which fixes bug 940 I hope.
if ((index < 0) || (index >= count)) {
_currentWaypt=NULL;
_prevWaypt=NULL;
- SG_LOG(SG_INSTR, SG_ALERT, "GPS: malformed route, index=" << index);
+ // no active leg on the route
return;
}
}
_legs.clear();
+ if (_delegate) {
+ _delegate->runCleared();
+ }
unlockDelegate();
}
if (_inner) _inner->runCurrentWaypointChanged();
currentWaypointChanged();
}
+
+void FlightPlan::Delegate::runCleared()
+{
+ if (_inner) _inner->runCleared();
+ cleared();
+}
} // of namespace flightgear
virtual void departureChanged() { }
virtual void arrivalChanged() { }
virtual void waypointsChanged() { }
-
+ virtual void cleared() { }
virtual void currentWaypointChanged() { }
protected:
void runArrivalChanged();
void runWaypointsChanged();
void runCurrentWaypointChanged();
-
+ void runCleared();
+
friend class FlightPlan;
bool _deleteWithPlan;
{
callDelegateMethod("currentWaypointChanged");
}
+
+ virtual void cleared()
+ {
+ callDelegateMethod("cleared");
+ }
private:
void callDelegateMethod(const char* method)