]> git.mxchange.org Git - flightgear.git/blobdiff - src/Environment/environment_mgr.cxx
Add support for moving cloud layers
[flightgear.git] / src / Environment / environment_mgr.cxx
index 6edbd6ca5f5e33abefc7fdc794186df1c84fc3c6..48690bafe0a50ba4f58abcb1b4d70e65b5f55691 100644 (file)
@@ -23,6 +23,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/scene/sky/sky.hxx>
 
+#include <Main/main.hxx>
 #include <Main/fg_props.hxx>
 #include <Aircraft/aircraft.hxx>
 
@@ -30,8 +31,6 @@
 #include "environment_ctrl.hxx"
 #include "environment_mgr.hxx"
 
-extern SGSky *thesky;          // FIXME: from main.cxx
-
 
 FGEnvironmentMgr::FGEnvironmentMgr ()
   : _environment(new FGEnvironment),
@@ -248,8 +247,17 @@ FGEnvironmentMgr::get_cloud_layer_elevation_ft (int index) const
 void
 FGEnvironmentMgr::set_cloud_layer_elevation_ft (int index, double elevation_ft)
 {
+  FGEnvironment env = *_environment;
+  env.set_elevation_ft(elevation_ft);
+
   thesky->get_cloud_layer(index)
     ->setElevation_m(elevation_ft * SG_FEET_TO_METER);
+
+  thesky->get_cloud_layer(index)
+    ->setSpeed(env.get_wind_speed_kt() * 0.5151);      // 1 kt = 0.5151 m/s
+
+  thesky->get_cloud_layer(index)
+    ->setDirection(env.get_wind_from_heading_deg());
 }
 
 double