]> git.mxchange.org Git - flightgear.git/commitdiff
Move fgSetupWind() from options.cxx to util.cxx
authorehofman <ehofman>
Mon, 23 Feb 2004 09:37:28 +0000 (09:37 +0000)
committerehofman <ehofman>
Mon, 23 Feb 2004 09:37:28 +0000 (09:37 +0000)
src/Main/options.cxx
src/Main/util.cxx
src/Main/util.hxx

index 17611685d30aa3a0b82f831c3cb2819e6c98f5f3..dfd6abea64541f492ed7e77ec2fa29568cd402ee 100644 (file)
@@ -535,67 +535,6 @@ add_channel( const string& type, const string& channel_str ) {
 }
 
 
-void
-fgSetupWind (double min_hdg, double max_hdg, double speed, double gust)
-{
-                                // Initialize to a reasonable state
-  fgDefaultWeatherValue("wind-from-heading-deg", min_hdg);
-  fgDefaultWeatherValue("wind-speed-kt", speed);
-
-  SG_LOG(SG_GENERAL, SG_INFO, "WIND: " << min_hdg << '@' << 
-        speed << " knots" << endl);
-
-                                // Now, add some variety to the layers
-  min_hdg += 10;
-  if (min_hdg > 360)
-      min_hdg -= 360;
-  speed *= 1.1;
-  fgSetDouble("/environment/config/boundary/entry[1]/wind-from-heading-deg",
-              min_hdg);
-  fgSetDouble("/environment/config/boundary/entry[1]/wind-speed-kt",
-              speed);
-
-  min_hdg += 20;
-  if (min_hdg > 360)
-      min_hdg -= 360;
-  speed *= 1.1;
-  fgSetDouble("/environment/config/aloft/entry[0]/wind-from-heading-deg",
-              min_hdg);
-  fgSetDouble("/environment/config/aloft/entry[0]/wind-speed-kt",
-              speed);
-              
-  min_hdg += 10;
-  if (min_hdg > 360)
-      min_hdg -= 360;
-  speed *= 1.1;
-  fgSetDouble("/environment/config/aloft/entry[1]/wind-from-heading-deg",
-              min_hdg);
-  fgSetDouble("/environment/config/aloft/entry[1]/wind-speed-kt",
-              speed);
-              
-  min_hdg += 10;
-  if (min_hdg > 360)
-      min_hdg -= 360;
-  speed *= 1.1;
-  fgSetDouble("/environment/config/aloft/entry[2]/wind-from-heading-deg",
-              min_hdg);
-  fgSetDouble("/environment/config/aloft/entry[2]/wind-speed-kt",
-              speed);
-
-#ifdef FG_WEATHERCM
-  // convert to fps
-  speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
-  while (min_hdg > 360)
-    min_hdg -= 360;
-  while (min_hdg <= 0)
-    min_hdg += 360;
-  min_hdg *= SGD_DEGREES_TO_RADIANS;
-  fgSetDouble("/environment/wind-from-north-fps", speed * cos(dir));
-  fgSetDouble("/environment/wind-from-east-fps", speed * sin(dir));
-#endif // FG_WEATHERCM
-}
-
-
 // Parse --wp=ID[@alt]
 static bool 
 parse_wp( const string& arg ) {
index 308ac756ab645cae078edfb6ed8fefb2df906e0d..9525f1d582553cd6760ba5a19eccfb41ba143f00 100644 (file)
@@ -52,6 +52,67 @@ fgDefaultWeatherValue (const char * propname, double value)
 }
 
 
+void
+fgSetupWind (double min_hdg, double max_hdg, double speed, double gust)
+{
+                                // Initialize to a reasonable state
+  fgDefaultWeatherValue("wind-from-heading-deg", min_hdg);
+  fgDefaultWeatherValue("wind-speed-kt", speed);
+
+  SG_LOG(SG_GENERAL, SG_INFO, "WIND: " << min_hdg << '@' <<
+         speed << " knots" << endl);
+
+                                // Now, add some variety to the layers
+  min_hdg += 10;
+  if (min_hdg > 360)
+      min_hdg -= 360;
+  speed *= 1.1;
+  fgSetDouble("/environment/config/boundary/entry[1]/wind-from-heading-deg",
+              min_hdg);
+  fgSetDouble("/environment/config/boundary/entry[1]/wind-speed-kt",
+              speed);
+
+  min_hdg += 20;
+  if (min_hdg > 360)
+      min_hdg -= 360;
+  speed *= 1.1;
+  fgSetDouble("/environment/config/aloft/entry[0]/wind-from-heading-deg",
+              min_hdg);
+  fgSetDouble("/environment/config/aloft/entry[0]/wind-speed-kt",
+              speed);
+
+  min_hdg += 10;
+  if (min_hdg > 360)
+      min_hdg -= 360;
+  speed *= 1.1;
+  fgSetDouble("/environment/config/aloft/entry[1]/wind-from-heading-deg",
+              min_hdg);
+  fgSetDouble("/environment/config/aloft/entry[1]/wind-speed-kt",
+              speed);
+
+  min_hdg += 10;
+  if (min_hdg > 360)
+      min_hdg -= 360;
+  speed *= 1.1;
+  fgSetDouble("/environment/config/aloft/entry[2]/wind-from-heading-deg",
+              min_hdg);
+  fgSetDouble("/environment/config/aloft/entry[2]/wind-speed-kt",
+              speed);
+
+#ifdef FG_WEATHERCM
+  // convert to fps
+  speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
+  while (min_hdg > 360)
+    min_hdg -= 360;
+  while (min_hdg <= 0)
+    min_hdg += 360;
+  min_hdg *= SGD_DEGREES_TO_RADIANS;
+  fgSetDouble("/environment/wind-from-north-fps", speed * cos(dir));
+  fgSetDouble("/environment/wind-from-east-fps", speed * sin(dir));
+#endif // FG_WEATHERCM
+}
+
+
 void
 fgExit (int status)
 {
index 093e7d69e7e78cd571a25e613e691c7a94dcd02b..773a8c517cea712ce5ca2095f0fa6ce0ba0c35c7 100644 (file)
 extern void fgDefaultWeatherValue (const char * propname, double value);
 
 
+/**
+ * Set up a plausible wind layout, boundary and aloft,
+ * based on just a few parameters.
+ *
+ * @param min_hdg Minimal wind heading
+ * @param max_hdg Maximal wind heading
+ * @param speed Windspeed in knots
+ * @param gust Wind gust variation in knots
+ */
+extern void fgSetupWind (double min_hdg, double max_hdg,
+                         double speed, double gust);
+
 /**
  * Clean up and exit FlightGear.
  *