]> git.mxchange.org Git - flightgear.git/commitdiff
Move initial setup of cloud layers to Main/main.cxx to ensure that
authordavid <david>
Wed, 5 Jun 2002 17:45:42 +0000 (17:45 +0000)
committerdavid <david>
Wed, 5 Jun 2002 17:45:42 +0000 (17:45 +0000)
they are done only once, and ensure that all properties are untied in
unbind().

src/Environment/environment_mgr.cxx
src/Environment/environment_mgr.hxx

index 61cfb69ee6ccc4bb905501a8222b7bfc6c0c6c74..6f82b95afdf95f62a3e0088fa13a6c130a5bc346 100644 (file)
@@ -32,8 +32,6 @@
 
 extern SGSky *thesky;          // FIXME: from main.cxx
 
-#define MAX_CLOUD_LAYERS 5
-
 
 FGEnvironmentMgr::FGEnvironmentMgr ()
   : _environment(new FGEnvironment),
@@ -54,14 +52,6 @@ FGEnvironmentMgr::init ()
   _controller->setEnvironment(_environment);
   _controller->init();
   _update_fdm();
-
-  SGPath texture_path(globals->get_fg_root());
-  texture_path.append("Textures");
-  texture_path.append("Sky");
-  for (int i = 0; i < MAX_CLOUD_LAYERS; i++) {
-    SGCloudLayer * layer = new SGCloudLayer(texture_path.str());
-    thesky->add_cloud_layer(layer);
-  }
 }
 
 void
@@ -146,6 +136,19 @@ FGEnvironmentMgr::unbind ()
   fgUntie("/environment/wind-from-north-fps");
   fgUntie("/environment/wind-from-east-fps");
   fgUntie("/environment/wind-from-down-fps");
+  for (int i = 0; i < MAX_CLOUD_LAYERS; i++) {
+    char buf[128];
+    sprintf(buf, "/environment/clouds/layer[%d]/span-m", i);
+    fgUntie(buf);
+    sprintf(buf, "/environment/clouds/layer[%d]/elevation-ft", i);
+    fgUntie(buf);
+    sprintf(buf, "/environment/clouds/layer[%d]/thickness-ft", i);
+    fgUntie(buf);
+    sprintf(buf, "/environment/clouds/layer[%d]/transition-ft", i);
+    fgUntie(buf);
+    sprintf(buf, "/environment/clouds/layer[%d]/type", i);
+    fgUntie(buf);
+  }
 }
 
 void
index 4caf6e22ec7b24b7c43a56b00515eec88e059635..0ad652e71108c987fcddf15796df09769294898e 100644 (file)
@@ -45,6 +45,10 @@ class FGEnvironmentMgr : public FGSubsystem
 
 public:
 
+  enum {
+    MAX_CLOUD_LAYERS = 5
+  };
+
   FGEnvironmentMgr ();
   virtual ~FGEnvironmentMgr ();