]> git.mxchange.org Git - flightgear.git/commitdiff
Mask error message 'Failed to find runway 28R at ...' when no runway is requested...
authorfredb <fredb>
Wed, 31 May 2006 07:20:10 +0000 (07:20 +0000)
committerfredb <fredb>
Wed, 31 May 2006 07:20:10 +0000 (07:20 +0000)
src/Main/fg_init.cxx
src/Main/options.cxx

index ae570d9ce3c9a26483af1875a760652cf69e0406..37248c27ac4a1c0dc78ea9d4809737856086810d 100644 (file)
@@ -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());
index 48b6f20b77712df0bef7df00c4b1053c33fa2e03..138b45aec4599bd6d747fd904ca9e2f49e11506a 100644 (file)
@@ -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<string,size_t> 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 },