+// Parse --wp=ID[,alt]
+bool fgOPTIONS::parse_wp( const string& arg ) {
+ string id, alt_str;
+ double alt = 0.0;
+
+ int pos = arg.find( "@" );
+ if ( pos != string::npos ) {
+ id = arg.substr( 0, pos );
+ alt_str = arg.substr( pos + 1 );
+ // cout << "id str = " << id << " alt str = " << alt_str << endl;
+ alt = atof( alt_str.c_str() );
+ if ( units == FG_UNITS_FEET ) {
+ alt *= FEET_TO_METER;
+ }
+ } else {
+ id = arg;
+ }
+
+ FGAirport a;
+ if ( fgFindAirportID( id, &a ) ) {
+ SGWayPoint wp( a.longitude, a.latitude, alt, SGWayPoint::WGS84, id );
+ globals->get_route()->add_waypoint( wp );
+
+ return true;
+ } else {
+ return false;
+ }
+}
+
+