]> git.mxchange.org Git - flightgear.git/commitdiff
Make --metar automatically imply --disable-real-weather-fetch
authorFlorent Rougon <f.rougon@free.fr>
Sun, 20 Mar 2016 18:56:18 +0000 (19:56 +0100)
committerFlorent Rougon <f.rougon@free.fr>
Sun, 20 Mar 2016 18:56:18 +0000 (19:56 +0100)
The --metar option has no effect unless --disable-real-weather-fetch is
also passed. This often makes users believe that --metar doesn't work.
Change the implementation for --metar so that it automatically implies
--disable-real-weather-fetch.

src/Main/options.cxx

index 3c4b36f36f6a0e90323f1715dcb40f8dd7a491d1..bd1a91e07cc885caa47ce47c8706008519812dc1 100644 (file)
@@ -1096,6 +1096,18 @@ fgOptVisibilityMiles( const char *arg )
     return FG_OPTIONS_OK;
 }
 
+static int
+fgOptMetar( const char *arg )
+{
+    // The given METAR string cannot be effective without disabling
+    // real weather fetching.
+    fgSetBool("/environment/realwx/enabled", false);
+    // The user-supplied METAR string
+    fgSetString("/environment/metar/data", arg);
+
+    return FG_OPTIONS_OK;
+}
+
 static int
 fgOptRandomWind( const char *arg )
 {
@@ -1531,7 +1543,7 @@ struct OptionDesc {
     {"enable-random-buildings",      false, OPTION_BOOL,   "/sim/rendering/random-buildings", true, "", 0 },
     {"disable-real-weather-fetch",   false, OPTION_BOOL,   "/environment/realwx/enabled", false, "", 0 },
     {"enable-real-weather-fetch",    false, OPTION_BOOL,   "/environment/realwx/enabled", true,  "", 0 },
-    {"metar",                        true,  OPTION_STRING, "/environment/metar/data", false, "", 0 },
+    {"metar",                        true,  OPTION_FUNC,   "", false, "", fgOptMetar },
     {"disable-ai-models",            false, OPTION_BOOL,   "/sim/ai/enabled", false, "", 0 },
     {"enable-ai-models",             false, OPTION_BOOL,   "/sim/ai/enabled", true, "", 0 },
     {"disable-ai-traffic",           false, OPTION_BOOL,   "/sim/traffic-manager/enabled", false, "", 0 },