]> git.mxchange.org Git - flightgear.git/commitdiff
Flightplan delegate hook for clearing the FP.
authorJames Turner <jmt@Bishop.local>
Mon, 31 Dec 2012 17:39:52 +0000 (17:39 +0000)
committerJames Turner <jmt@Bishop.local>
Mon, 31 Dec 2012 17:39:52 +0000 (17:39 +0000)
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.

src/Instrumentation/gps.cxx
src/Navaids/FlightPlan.cxx
src/Navaids/FlightPlan.hxx
src/Scripting/NasalPositioned.cxx

index 158b87c6ca63025421c00abb03e5ad8e57944af0..21485d4eb49045fe37155d80d5553b49c5567272 100644 (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;
   }
   
index b66108fbb39c472fadb7a0191cb51995bbd1fd3d..eda1e2db5e6f852cf44af8c1bc3b476b73e2726e 100644 (file)
@@ -226,6 +226,9 @@ void FlightPlan::clear()
   }
   _legs.clear();  
   
+  if (_delegate) {
+    _delegate->runCleared();
+  }
   unlockDelegate();
 }
   
@@ -1205,5 +1208,11 @@ void FlightPlan::Delegate::runCurrentWaypointChanged()
   if (_inner) _inner->runCurrentWaypointChanged();
   currentWaypointChanged();
 }
+
+void FlightPlan::Delegate::runCleared()
+{
+  if (_inner) _inner->runCleared();
+  cleared();
+}  
   
 } // of namespace flightgear
index 3eeb02cf64f7f30e1f2e18017bf44665b32920ff..84944069aa0202ae6a7e04ea2034b5e3133e92c6 100644 (file)
@@ -104,7 +104,7 @@ public:
     virtual void departureChanged() { }
     virtual void arrivalChanged() { }
     virtual void waypointsChanged() { }
-    
+    virtual void cleared() { }
     virtual void currentWaypointChanged() { }
   
   protected:
@@ -117,7 +117,8 @@ public:
     void runArrivalChanged();
     void runWaypointsChanged();
     void runCurrentWaypointChanged();
-    
+    void runCleared();
+      
     friend class FlightPlan;
     
     bool _deleteWithPlan;
index 252342516c54124943f9ac1e141cdbb365730c6f..cfdadf68f590804f5d577eb5fedd75e291a0abba 100644 (file)
@@ -1772,6 +1772,11 @@ public:
   {
     callDelegateMethod("currentWaypointChanged");
   }
+    
+  virtual void cleared()
+  {
+    callDelegateMethod("cleared");
+  }
 private:
   
   void callDelegateMethod(const char* method)