diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 836af0dad..47b6847ad 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1031,12 +1031,31 @@ fgOptWind( const char *arg ) } static int -fgOptTurbulence( const char *arg) +fgOptTurbulence( const char *arg ) { fgDefaultWeatherValue("turbulence/magnitude-norm", atof(arg)); return FG_OPTIONS_OK; } +static int +fgOptCeiling( const char *arg ) +{ + double elevation, thickness; + string spec = arg; + string::size_type pos = spec.find(':'); + if (pos == string::npos) { + elevation = atof(spec.c_str()); + thickness = 2000; + } else { + elevation = atof(spec.substr(0, pos).c_str()); + thickness = atof(spec.substr(pos + 1).c_str()); + } + fgSetDouble("/environment/clouds/layer[0]/elevation-ft", elevation); + fgSetDouble("/environment/clouds/layer[0]/thickness-ft", thickness); + fgSetString("/environment/clouds/layer[0]/coverage", "overcast"); + return FG_OPTIONS_OK; +} + static int fgOptWp( const char *arg ) { @@ -1315,6 +1334,7 @@ struct OptionDesc { {"random-wind", false, OPTION_FUNC, "", false, "", fgOptRandomWind }, {"wind", true, OPTION_FUNC, "", false, "", fgOptWind }, {"turbulence", true, OPTION_FUNC, "", false, "", fgOptTurbulence }, + {"ceiling", true, OPTION_FUNC, "", false, "", fgOptCeiling }, {"wp", true, OPTION_FUNC, "", false, "", fgOptWp }, {"flight-plan", true, OPTION_FUNC, "", false, "", fgOptFlightPlan }, {"config", true, OPTION_FUNC, "", false, "", fgOptConfig },