From 0f927d5766f98015b617a0349c19f41d67c7fae5 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 26 Sep 2012 22:43:19 +0100 Subject: [PATCH] Part of bug 885 Allow the route-manager to be explicitly de-activated. --- src/Autopilot/route_mgr.cxx | 11 ++++++++++- src/Autopilot/route_mgr.hxx | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index e685b8888..d39c49c55 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -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() { diff --git a/src/Autopilot/route_mgr.hxx b/src/Autopilot/route_mgr.hxx index d0adfb4a1..baa5e2c50 100644 --- a/src/Autopilot/route_mgr.hxx +++ b/src/Autopilot/route_mgr.hxx @@ -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 -- 2.39.5