From: James Turner Date: Wed, 26 Sep 2012 21:43:19 +0000 (+0100) Subject: Part of bug 885 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0f927d5766f98015b617a0349c19f41d67c7fae5;p=flightgear.git Part of bug 885 Allow the route-manager to be explicitly de-activated. --- 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