From: david Date: Mon, 1 Sep 2003 22:58:19 +0000 (+0000) Subject: Add a --ceiling=FT_AGL[:THICKNESS_AGL] option to create a default X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2ce5cbf854ced054e37ae8d95c2bbeb496518cce;p=flightgear.git Add a --ceiling=FT_AGL[:THICKNESS_AGL] option to create a default overcast ceiling at the given altitude AGL, optionally with the given thickness (or default to 2000 ft). --- 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 },