From 2ff16ca93fc5cc9ce51d1727a1adc54ffbf586d5 Mon Sep 17 00:00:00 2001 From: mfranz Date: Wed, 10 May 2006 09:40:08 +0000 Subject: [PATCH] - set target altitude if a new WP becomes active through deleting/inserting - cosmetics --- src/Autopilot/route_mgr.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index 78b15f167..302d363de 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -229,6 +229,9 @@ void FGRouteMgr::update( double dt ) { void FGRouteMgr::add_waypoint( const SGWayPoint& wp, int n ) { + if ( n == 0 ) + altitude_set = false; + route->add_waypoint( wp, n ); update_mirror(); } @@ -262,6 +265,9 @@ SGWayPoint FGRouteMgr::pop_waypoint( int n ) { wp0_eta->setStringValue( "" ); } + if ( n == 0 && route->size() ) + altitude_set = false; + update_mirror(); return wp; } @@ -285,8 +291,8 @@ int FGRouteMgr::new_waypoint( const string& Tgt_Alt, int n ) { int type = make_waypoint( &wp, target ); if (wp) { - fgSetString( "/autopilot/locks/heading", "true-heading-hold" ); add_waypoint( *wp, n ); + fgSetString( "/autopilot/locks/heading", "true-heading-hold" ); delete wp; } return type; @@ -307,7 +313,7 @@ int FGRouteMgr::make_waypoint(SGWayPoint **wp, string& target) { } // check for lon,lat - pos = target.find(','); + pos = target.find( ',' ); if ( pos != string::npos ) { double lon = atof( target.substr(0, pos).c_str()); double lat = atof( target.c_str() + pos + 1); @@ -359,7 +365,7 @@ int FGRouteMgr::make_waypoint(SGWayPoint **wp, string& target) { return 4; } - // target not identified + // unknown target return 0; }