From: fredb Date: Wed, 31 May 2006 07:20:10 +0000 (+0000) Subject: Mask error message 'Failed to find runway 28R at ...' when no runway is requested... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=35a8d66415661bed8d90e8cad84002394b32c5f3;p=flightgear.git Mask error message 'Failed to find runway 28R at ...' when no runway is requested in the command line --- diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index ae570d9ce..37248c27a 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -765,7 +765,7 @@ static bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) { // Set current_options lon/lat given an airport id and runway number -static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy ) { +static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy, bool rwy_req ) { FGRunway r; if ( id.length() ) { @@ -776,7 +776,7 @@ static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy ) { << id << ":" << rwy ); if ( ! globals->get_runways()->search( id, rwy, &r ) ) { - SG_LOG( SG_GENERAL, SG_ALERT, + SG_LOG( SG_GENERAL, rwy_req ? SG_ALERT : SG_INFO, "Failed to find runway " << rwy << " at airport " << id ); return false; @@ -1123,6 +1123,7 @@ bool fgInitPosition() { string apt = fgGetString("/sim/presets/airport-id"); string rwy_no = fgGetString("/sim/presets/runway"); + bool rwy_req = fgGetBool("/sim/presets/runway-requested"); double hdg = fgGetDouble("/sim/presets/heading-deg"); string vor = fgGetString("/sim/presets/vor-id"); double vor_freq = fgGetDouble("/sim/presets/vor-freq"); @@ -1137,7 +1138,7 @@ bool fgInitPosition() { if ( !set_pos && !apt.empty() && !rwy_no.empty() ) { // An airport + runway is requested - if ( fgSetPosFromAirportIDandRwy( apt, rwy_no ) ) { + if ( fgSetPosFromAirportIDandRwy( apt, rwy_no, rwy_req ) ) { // set tower position (a little off the heading for single // runway airports) fgSetString("/sim/tower/airport-id", apt.c_str()); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 48b6f20b7..138b45aec 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1183,6 +1183,14 @@ fgOptScenario( const char *arg ) return FG_OPTIONS_OK; } +static int +fgOptRunway( const char *arg ) +{ + fgSetString("/sim/presets/runway", arg ); + fgSetBool("/sim/presets/runway-requested", true ); + return FG_OPTIONS_OK; +} + static map fgOptionMap; /* @@ -1260,7 +1268,7 @@ struct OptionDesc { {"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 }, + {"runway", true, OPTION_FUNC, "", false, "", fgOptRunway }, {"vor", true, OPTION_FUNC, "", false, "", fgOptVOR }, {"ndb", true, OPTION_FUNC, "", false, "", fgOptNDB }, {"carrier", true, OPTION_FUNC, "", false, "", fgOptCarrier },