From 0cfa4ced9cd5e2ec26e753ddd5f61da7558221a6 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Sun, 20 Mar 2016 19:56:18 +0100 Subject: [PATCH] Make --metar automatically imply --disable-real-weather-fetch 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 3c4b36f36..bd1a91e07 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -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 }, -- 2.39.5