X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FMain%2Foptions.cxx;h=e7bf6d0c7076cc04802ace52ca7f3e060f6a8365;hb=b3e969726249e772da4c9d1aa6eb212e6472aed3;hp=6235939e05b952e5098bd83aa82f9bcf4a45c249;hpb=966e0bdd4dcabdb20b9c68863a3bd0533b80b189;p=flightgear.git diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 6235939e0..e7bf6d0c7 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -184,7 +184,7 @@ fgSetDefaults () fgSetBool("/sim/hud/enable3d", true); fgSetBool("/sim/hud/visibility", false); fgSetBool("/sim/panel/visibility", true); - fgSetBool("/sim/sound/audible", true); + fgSetBool("/sim/sound/pause", false); // Flight Model options fgSetString("/sim/flight-model", "jsb"); @@ -534,36 +534,19 @@ add_channel( const string& type, const string& channel_str ) { 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 +static void 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_list *waypoints = globals->get_initial_waypoints(); + if (!waypoints) { + waypoints = new string_list; } + waypoints->push_back(arg); + globals->set_initial_waypoints(waypoints); } @@ -571,31 +554,34 @@ parse_wp( const string& arg ) { static bool parse_flightplan(const string& arg) { - sg_gzifstream in(arg.c_str()); - if ( !in.is_open() ) { - return false; - } - while ( true ) { - string line; - + string_list *waypoints = globals->get_initial_waypoints(); + if (!waypoints) + waypoints = new string_list; + sg_gzifstream in(arg.c_str()); + if ( !in.is_open() ) { + return false; + } + while ( true ) { + string line; + #if defined( macintosh ) - getline( in, line, '\r' ); + getline( in, line, '\r' ); #else - getline( in, line, '\n' ); + getline( in, line, '\n' ); #endif - - // catch extraneous (DOS) line ending character - if ( line[line.length() - 1] < 32 ) { - line = line.substr( 0, line.length()-1 ); - } - - if ( in.eof() ) { - break; - } - parse_wp(line); + + // catch extraneous (DOS) line ending character + if ( line[line.length() - 1] < 32 ) { + line = line.substr( 0, line.length()-1 ); } - - return true; + + if ( in.eof() ) { + break; + } + waypoints->push_back(line); + } + globals->set_initial_waypoints(waypoints); + return true; } static int @@ -1200,6 +1186,8 @@ struct OptionDesc { {"enable-mouse-pointer", false, OPTION_STRING, "/sim/startup/mouse-pointer", false, "enabled", 0 }, {"disable-random-objects", false, OPTION_BOOL, "/sim/rendering/random-objects", false, "", 0 }, {"enable-random-objects", false, OPTION_BOOL, "/sim/rendering/random-objects", true, "", 0 }, + {"disable-ai-models", false, OPTION_BOOL, "/sim/ai/enabled", false, "", 0 }, + {"enable-ai-models", false, OPTION_BOOL, "/sim/ai/enabled", true, "", 0 }, {"disable-freeze", false, OPTION_BOOL, "/sim/freeze/master", false, "", 0 }, {"enable-freeze", false, OPTION_BOOL, "/sim/freeze/master", true, "", 0 }, {"disable-fuel-freeze", false, OPTION_BOOL, "/sim/freeze/fuel", false, "", 0 }, @@ -1218,8 +1206,8 @@ struct OptionDesc { {"enable-hud", false, OPTION_BOOL, "/sim/hud/visibility", true, "", 0 }, {"disable-panel", false, OPTION_BOOL, "/sim/panel/visibility", false, "", 0 }, {"enable-panel", false, OPTION_BOOL, "/sim/panel/visibility", true, "", 0 }, - {"disable-sound", false, OPTION_BOOL, "/sim/sound/audible", false, "", 0 }, - {"enable-sound", false, OPTION_BOOL, "/sim/sound/audible", true, "", 0 }, + {"disable-sound", false, OPTION_BOOL, "/sim/sound/pause", true, "", 0 }, + {"enable-sound", false, OPTION_BOOL, "/sim/sound/pause", false, "", 0 }, {"airport", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 }, {"airport-id", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 }, {"runway", true, OPTION_STRING, "/sim/presets/runway", false, "", 0 },