]> git.mxchange.org Git - flightgear.git/commitdiff
Add a --ceiling=FT_AGL[:THICKNESS_AGL] option to create a default
authordavid <david>
Mon, 1 Sep 2003 22:58:19 +0000 (22:58 +0000)
committerdavid <david>
Mon, 1 Sep 2003 22:58:19 +0000 (22:58 +0000)
overcast ceiling at the given altitude AGL, optionally with the given
thickness (or default to 2000 ft).

src/Main/options.cxx

index 836af0dad5ada1bc23995a45eec6f12f8855ba1b..47b6847ad508099eb143b6175e569743f6196857 100644 (file)
@@ -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 },