class Sound;
extern const char *default_root;
+extern string_list waypoints;
#ifdef FG_USE_CLOUDS_3D
SkySceneLoader *sgCloud3d;
fgSetDouble("/sim/presets/glideslope-deg", 0);
fgSetBool("/sim/presets/onground", true);
}
-}
+}
// Set current_options lon/lat given an airport id and heading (degrees)
return false;
}
}
+
+static bool parseWaypoints()
+ {
+ vector<string>::iterator i;
+ for (i = waypoints.begin();
+ i != waypoints.end();
+ i++)
+ {
+ NewWaypoint(*i);
+ // string arg = *i;
+// string id, alt_str;
+// double alt = 0.0;
+
+// string::size_type 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 ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
+// alt *= SG_FEET_TO_METER;
+// }
+// } else {
+// id = arg;
+// }
+
+// FGAirport a;
+// if ( fgFindAirportID( id, &a ) ) {
+// FGRouteMgr *rm = (FGRouteMgr *)globals->get_subsystem("route-manager");
+// SGWayPoint wp( a.longitude, a.latitude, alt, SGWayPoint::WGS84, id );
+// rm->add_waypoint( wp );
+
+// //return true;
+// } else {
+// return false;
+// }
+// }
+// // waypoints.begin() = waypoints.erase(waypoints.begin());
+// return true;
+ }
+ }
+
+
+
/**
globals->add_subsystem( "xml-autopilot", new FGXMLAutopilot );
globals->add_subsystem( "route-manager", new FGRouteMgr );
+
////////////////////////////////////////////////////////////////////
// Initialize the view manager subsystem.
////////////////////////////////////////////////////////////////////
globals->add_subsystem("nasal", nasal);
nasal->init();
+ ////////////////////////////////////////////////////////////////////
+ // At this point we could try and parse the waypoint options
+ ///////////////////////////////////////////////////////////////////
+ parseWaypoints();
+
+
////////////////////////////////////////////////////////////////////////
// End of subsystem initialization.
////////////////////////////////////////////////////////////////////
#define NEW_DEFAULT_MODEL_HZ 120
+string_list waypoints;
+
enum
{
FG_OPTIONS_OK = 0,
return true;
}
+// The parse wp and parse flight-plan options don't work anymore, because
+// the route manager and the airport subsystems have not yet been initialized
+// at this stage.
// Parse --wp=ID[@alt]
static bool
parse_wp( const string& arg ) {
- string id, alt_str;
- double alt = 0.0;
-
- string::size_type 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 ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
- alt *= SG_FEET_TO_METER;
- }
- } else {
- id = arg;
- }
-
- FGAirport a;
- if ( fgFindAirportID( id, &a ) ) {
- FGRouteMgr *rm = (FGRouteMgr *)globals->get_subsystem("route-manager");
- SGWayPoint wp( a.longitude, a.latitude, alt, SGWayPoint::WGS84, id );
- rm->add_waypoint( wp );
-
- return true;
- } else {
- return false;
- }
+ //string id, alt_str;
+ //double alt = 0.0;
+ //
+ //string::size_type 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 ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
+ // alt *= SG_FEET_TO_METER;
+ //}
+ //} else {
+ //id = arg;
+ //}
+ //
+ //FGAirport a;
+ //if ( fgFindAirportID( id, &a ) ) {
+ // FGRouteMgr *rm = (FGRouteMgr *)globals->get_subsystem("route-manager");
+ //SGWayPoint wp( a.longitude, a.latitude, alt, SGWayPoint::WGS84, id );
+ //rm->add_waypoint( wp );
+ //
+ //return true;
+ //} else {
+ //return false;
+ //}
+ //}
+ waypoints.push_back(arg);
}
if ( in.eof() ) {
break;
}
- parse_wp(line);
+ //parse_wp(line);
+ waypoints.push_back(line);
}
return true;