From 6c1be4fffb4a7d52f3fc954aa7ef66d558fb3096 Mon Sep 17 00:00:00 2001 From: mfranz Date: Fri, 12 May 2006 15:37:25 +0000 Subject: [PATCH] - remove listener first in the destructor - make function arg const again --- src/Autopilot/route_mgr.cxx | 21 ++++++++++----------- src/Autopilot/route_mgr.hxx | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index b95b39b8e..3e7c03177 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -68,8 +68,8 @@ FGRouteMgr::FGRouteMgr() : FGRouteMgr::~FGRouteMgr() { - delete route; input->removeChangeListener(listener); + delete route; } @@ -280,14 +280,7 @@ bool FGRouteMgr::build() { } -int FGRouteMgr::new_waypoint( const string& Tgt_Alt, int n ) { - string target = Tgt_Alt; - - // make upper case - for (unsigned int i = 0; i < target.size(); i++) - if (target[i] >= 'a' && target[i] <= 'z') - target[i] -= 'a' - 'A'; - +int FGRouteMgr::new_waypoint( const string& target, int n ) { SGWayPoint *wp = 0; int type = make_waypoint( &wp, target ); @@ -302,10 +295,16 @@ int FGRouteMgr::new_waypoint( const string& Tgt_Alt, int n ) { } -int FGRouteMgr::make_waypoint(SGWayPoint **wp, string& target) { - double alt = -9999.0; +int FGRouteMgr::make_waypoint( SGWayPoint **wp, const string& tgt ) { + string target = tgt; + + // make upper case + for (unsigned int i = 0; i < target.size(); i++) + if (target[i] >= 'a' && target[i] <= 'z') + target[i] -= 'a' - 'A'; // extract altitude + double alt = -9999.0; unsigned int pos = target.find( '@' ); if ( pos != string::npos ) { alt = atof( target.c_str() + pos + 1 ); diff --git a/src/Autopilot/route_mgr.hxx b/src/Autopilot/route_mgr.hxx index 22d373a3d..0c02c2cdc 100644 --- a/src/Autopilot/route_mgr.hxx +++ b/src/Autopilot/route_mgr.hxx @@ -93,7 +93,7 @@ private: SGPropertyNode_ptr mirror; bool altitude_set; - int make_waypoint( SGWayPoint **wp, string& target ); + int make_waypoint( SGWayPoint **wp, const string& target ); void update_mirror(); bool near_ground();