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; return false;
} }
_plan->setCurrentIndex(0); _plan->activate();
active->setBoolValue(true); active->setBoolValue(true);
SG_LOG(SG_AUTOPILOT, SG_INFO, "route-manager, activate route ok"); SG_LOG(SG_AUTOPILOT, SG_INFO, "route-manager, activate route ok");
return true; return true;

View file

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

View file

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

View file

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