From 0751556aabb4daf61bb915ef90df84e1ab6942c4 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 5 Nov 2013 05:29:55 +0000 Subject: [PATCH] Reset: remove commands --- src/AIModel/AIManager.cxx | 3 +++ src/Autopilot/route_mgr.cxx | 13 ++++++++++--- src/Environment/fgclouds.cxx | 4 ++++ src/Environment/realwx_ctrl.cxx | 26 ++++++++++++++------------ 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index b7ec95a84..c0d8a78a7 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -181,6 +181,9 @@ FGAIManager::shutdown() } ai_list.clear(); + + globals->get_commands()->removeCommand("load-scenario"); + globals->get_commands()->removeCommand("unload-scenario"); } void diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index fd46f4be7..72f3cccfe 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -238,9 +238,16 @@ FGRouteMgr::~FGRouteMgr() _plan->removeDelegate(this); } - //SGCommandMgr* cmdMgr = SGCommandMgr::instance(); - //cmdMgr->removeCommand("define-user-waypoint"); - + SGCommandMgr* cmdMgr = SGCommandMgr::instance(); + cmdMgr->removeCommand("define-user-waypoint"); + cmdMgr->removeCommand("delete-user-waypoint"); + cmdMgr->removeCommand("load-flightplan"); + cmdMgr->removeCommand("save-flightplan"); + cmdMgr->removeCommand("activate-flightplan"); + cmdMgr->removeCommand("clear-flightplan"); + cmdMgr->removeCommand("set-active-waypt"); + cmdMgr->removeCommand("insert-waypt"); + cmdMgr->removeCommand("delete-waypt"); } diff --git a/src/Environment/fgclouds.cxx b/src/Environment/fgclouds.cxx index 6e77d9b0e..58653e053 100644 --- a/src/Environment/fgclouds.cxx +++ b/src/Environment/fgclouds.cxx @@ -57,6 +57,10 @@ FGClouds::FGClouds() : FGClouds::~FGClouds() { + globals->get_commands()->removeCommand("add-cloud"); + globals->get_commands()->removeCommand("del-cloud"); + globals->get_commands()->removeCommand("move-cloud"); + } int FGClouds::get_update_event(void) const { diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx index 837815909..b45e0cbcf 100644 --- a/src/Environment/realwx_ctrl.cxx +++ b/src/Environment/realwx_ctrl.cxx @@ -232,30 +232,32 @@ BasicRealWxController::BasicRealWxController( SGPropertyNode_ptr rootNode, Metar _wasEnabled(false), _requester(metarRequester) { - // at least instantiate MetarProperties for /environment/metar - _metarProperties.push_back( new LiveMetarProperties( - fgGetNode( rootNode->getStringValue("metar", "/environment/metar"), true ), - metarRequester, - getMetarMaxAgeMin())); - - BOOST_FOREACH( SGPropertyNode_ptr n, rootNode->getChildren("metar") ) { - SGPropertyNode_ptr metarNode = fgGetNode( n->getStringValue(), true ); - addMetarAtPath(metarNode->getPath(), ""); - } - + SGCommandMgr::instance()->addCommand("request-metar", commandRequestMetar); SGCommandMgr::instance()->addCommand("clear-metar", commandClearMetar); } BasicRealWxController::~BasicRealWxController() { - //SGCommandMgr::instance()->removeCommand("request-metar"); + SGCommandMgr::instance()->removeCommand("request-metar"); + SGCommandMgr::instance()->removeCommand("clear-metar"); } void BasicRealWxController::init() { _wasEnabled = false; + // at least instantiate MetarProperties for /environment/metar + SGPropertyNode_ptr metarNode = fgGetNode( _rootNode->getStringValue("metar", "/environment/metar"), true ); + _metarProperties.push_back( new LiveMetarProperties(metarNode, + _requester, + getMetarMaxAgeMin())); + + BOOST_FOREACH( SGPropertyNode_ptr n, _rootNode->getChildren("metar") ) { + SGPropertyNode_ptr metarNode = fgGetNode( n->getStringValue(), true ); + addMetarAtPath(metarNode->getPath(), ""); + } + checkNearbyMetar(); update(0); // fetch data ASAP -- 2.39.5