1
0
Fork 0

Flightplan delegate hook for clearing the FP.

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.
This commit is contained in:
James Turner 2012-12-31 17:39:52 +00:00
parent 5ff8311acc
commit 369e6b564f
4 changed files with 18 additions and 3 deletions

View file

@ -716,7 +716,7 @@ void GPS::routeManagerSequenced()
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;
}

View file

@ -226,6 +226,9 @@ void FlightPlan::clear()
}
_legs.clear();
if (_delegate) {
_delegate->runCleared();
}
unlockDelegate();
}
@ -1206,4 +1209,10 @@ void FlightPlan::Delegate::runCurrentWaypointChanged()
currentWaypointChanged();
}
void FlightPlan::Delegate::runCleared()
{
if (_inner) _inner->runCleared();
cleared();
}
} // of namespace flightgear

View file

@ -104,7 +104,7 @@ public:
virtual void departureChanged() { }
virtual void arrivalChanged() { }
virtual void waypointsChanged() { }
virtual void cleared() { }
virtual void currentWaypointChanged() { }
protected:
@ -117,6 +117,7 @@ public:
void runArrivalChanged();
void runWaypointsChanged();
void runCurrentWaypointChanged();
void runCleared();
friend class FlightPlan;

View file

@ -1772,6 +1772,11 @@ public:
{
callDelegateMethod("currentWaypointChanged");
}
virtual void cleared()
{
callDelegateMethod("cleared");
}
private:
void callDelegateMethod(const char* method)