1
0
Fork 0

FlightPlan activation, delegate hook.

This commit is contained in:
James Turner 2015-01-25 11:29:19 +00:00
parent bcfa16b84a
commit 564177933b
4 changed files with 33 additions and 4 deletions

View file

@ -746,7 +746,7 @@ bool FGRouteMgr::activate()
return false;
}
_plan->setCurrentIndex(0);
_plan->activate();
active->setBoolValue(true);
SG_LOG(SG_AUTOPILOT, SG_INFO, "route-manager, activate route ok");
return true;

View file

@ -333,7 +333,21 @@ void FlightPlan::setCurrentIndex(int index)
_currentWaypointChanged = true;
unlockDelegate();
}
void FlightPlan::activate()
{
lockDelegate();
_currentIndex = 0;
_currentWaypointChanged = true;
if (_delegate) {
_delegate->runActivated();
}
unlockDelegate();
}
void FlightPlan::finish()
{
if (_currentIndex == -1) {
@ -1362,6 +1376,12 @@ void FlightPlan::Delegate::runFinished()
endOfFlightPlan();
}
void FlightPlan::Delegate::runActivated()
{
if (_inner) _inner->runActivated();
activated();
}
void FlightPlan::setFollowLegTrackToFixes(bool tf)
{
_followLegTrackToFix = tf;

View file

@ -121,6 +121,7 @@ public:
virtual void arrivalChanged() { }
virtual void waypointsChanged() { }
virtual void cleared() { }
virtual void activated() { }
virtual void currentWaypointChanged() { }
virtual void endOfFlightPlan() { }
protected:
@ -135,7 +136,8 @@ public:
void runCurrentWaypointChanged();
void runCleared();
void runFinished();
void runActivated();
friend class FlightPlan;
bool _deleteWithPlan;
@ -153,7 +155,9 @@ public:
{ return _currentIndex; }
void setCurrentIndex(int index);
void activate();
void finish();
Leg* currentLeg() const;

View file

@ -1807,6 +1807,11 @@ public:
{
callDelegateMethod("endOfFlightPlan");
}
virtual void activated()
{
callDelegateMethod("activated");
}
private:
void callDelegateMethod(const char* method)