Durk Talsma:
Enclosed you find a tar ball of the two files I changed to get the --waypoint and --flight-plan command line option to work again.
This commit is contained in:
parent
a9188cc5e3
commit
3db9dc5a23
2 changed files with 88 additions and 28 deletions
|
@ -140,6 +140,7 @@ SG_USING_STD(string);
|
||||||
class Sound;
|
class Sound;
|
||||||
|
|
||||||
extern const char *default_root;
|
extern const char *default_root;
|
||||||
|
extern string_list waypoints;
|
||||||
|
|
||||||
#ifdef FG_USE_CLOUDS_3D
|
#ifdef FG_USE_CLOUDS_3D
|
||||||
SkySceneLoader *sgCloud3d;
|
SkySceneLoader *sgCloud3d;
|
||||||
|
@ -900,7 +901,7 @@ static void fgSetDistOrAltFromGlideSlope() {
|
||||||
fgSetDouble("/sim/presets/glideslope-deg", 0);
|
fgSetDouble("/sim/presets/glideslope-deg", 0);
|
||||||
fgSetBool("/sim/presets/onground", true);
|
fgSetBool("/sim/presets/onground", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set current_options lon/lat given an airport id and heading (degrees)
|
// Set current_options lon/lat given an airport id and heading (degrees)
|
||||||
|
@ -999,6 +1000,50 @@ static bool fgSetPosFromFix( const string& id ) {
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1520,6 +1565,7 @@ bool fgInitSubsystems() {
|
||||||
globals->add_subsystem( "xml-autopilot", new FGXMLAutopilot );
|
globals->add_subsystem( "xml-autopilot", new FGXMLAutopilot );
|
||||||
globals->add_subsystem( "route-manager", new FGRouteMgr );
|
globals->add_subsystem( "route-manager", new FGRouteMgr );
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Initialize the view manager subsystem.
|
// Initialize the view manager subsystem.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1756,6 +1802,12 @@ bool fgInitSubsystems() {
|
||||||
globals->add_subsystem("nasal", nasal);
|
globals->add_subsystem("nasal", nasal);
|
||||||
nasal->init();
|
nasal->init();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// At this point we could try and parse the waypoint options
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
parseWaypoints();
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// End of subsystem initialization.
|
// End of subsystem initialization.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -67,6 +67,8 @@ SG_USING_NAMESPACE(std);
|
||||||
|
|
||||||
#define NEW_DEFAULT_MODEL_HZ 120
|
#define NEW_DEFAULT_MODEL_HZ 120
|
||||||
|
|
||||||
|
string_list waypoints;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
FG_OPTIONS_OK = 0,
|
FG_OPTIONS_OK = 0,
|
||||||
|
@ -534,36 +536,41 @@ add_channel( const string& type, const string& channel_str ) {
|
||||||
return true;
|
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]
|
// Parse --wp=ID[@alt]
|
||||||
static bool
|
static bool
|
||||||
parse_wp( const string& arg ) {
|
parse_wp( const string& arg ) {
|
||||||
string id, alt_str;
|
//string id, alt_str;
|
||||||
double alt = 0.0;
|
//double alt = 0.0;
|
||||||
|
//
|
||||||
string::size_type pos = arg.find( "@" );
|
//string::size_type pos = arg.find( "@" );
|
||||||
if ( pos != string::npos ) {
|
//if ( pos != string::npos ) {
|
||||||
id = arg.substr( 0, pos );
|
//id = arg.substr( 0, pos );
|
||||||
alt_str = arg.substr( pos + 1 );
|
//alt_str = arg.substr( pos + 1 );
|
||||||
// cout << "id str = " << id << " alt str = " << alt_str << endl;
|
//// cout << "id str = " << id << " alt str = " << alt_str << endl;
|
||||||
alt = atof( alt_str.c_str() );
|
//alt = atof( alt_str.c_str() );
|
||||||
if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
|
//if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
|
||||||
alt *= SG_FEET_TO_METER;
|
// alt *= SG_FEET_TO_METER;
|
||||||
}
|
//}
|
||||||
} else {
|
//} else {
|
||||||
id = arg;
|
//id = arg;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
FGAirport a;
|
//FGAirport a;
|
||||||
if ( fgFindAirportID( id, &a ) ) {
|
//if ( fgFindAirportID( id, &a ) ) {
|
||||||
FGRouteMgr *rm = (FGRouteMgr *)globals->get_subsystem("route-manager");
|
// FGRouteMgr *rm = (FGRouteMgr *)globals->get_subsystem("route-manager");
|
||||||
SGWayPoint wp( a.longitude, a.latitude, alt, SGWayPoint::WGS84, id );
|
//SGWayPoint wp( a.longitude, a.latitude, alt, SGWayPoint::WGS84, id );
|
||||||
rm->add_waypoint( wp );
|
//rm->add_waypoint( wp );
|
||||||
|
//
|
||||||
return true;
|
//return true;
|
||||||
} else {
|
//} else {
|
||||||
return false;
|
//return false;
|
||||||
}
|
//}
|
||||||
|
//}
|
||||||
|
waypoints.push_back(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -592,7 +599,8 @@ parse_flightplan(const string& arg)
|
||||||
if ( in.eof() ) {
|
if ( in.eof() ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parse_wp(line);
|
//parse_wp(line);
|
||||||
|
waypoints.push_back(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue