]> git.mxchange.org Git - flightgear.git/commitdiff
Part of bug 885
authorJames Turner <zakalawe@mac.com>
Wed, 26 Sep 2012 21:43:19 +0000 (22:43 +0100)
committerJames Turner <zakalawe@mac.com>
Wed, 26 Sep 2012 21:43:19 +0000 (22:43 +0100)
Allow the route-manager to be explicitly de-activated.

src/Autopilot/route_mgr.cxx
src/Autopilot/route_mgr.hxx

index e685b88884d72d9fb03688a1dce80fcda38323bf..d39c49c5546e877908abc71445f8e82bddba3e84 100644 (file)
@@ -79,7 +79,7 @@ static bool commandActivateFlightPlan(const SGPropertyNode* arg)
   if (activate) {
     self->activate();
   } else {
-    
+    self->deactivate();
   }
   
   return true;
@@ -784,6 +784,15 @@ bool FGRouteMgr::activate()
   return true;
 }
 
+void FGRouteMgr::deactivate()
+{
+  if (!isRouteActive()) {
+    return;
+  }
+  
+  SG_LOG(SG_AUTOPILOT, SG_INFO, "deactivating flight plan");
+  active->setBoolValue(false);
+}
 
 void FGRouteMgr::sequence()
 {
index d0adfb4a1e0526ddf9493a5254109146ba7c9d95..baa5e2c50f707d475a618074021dc06eb55cfd2f 100644 (file)
@@ -84,6 +84,11 @@ public:
    * route could not be activated for some reason
    */
   bool activate();
+  
+  /**
+   * deactivate the route if active
+   */
+  void deactivate();
 
   /**
    * Step to the next waypoint on the active route