From: david Date: Wed, 5 Jun 2002 17:45:42 +0000 (+0000) Subject: Move initial setup of cloud layers to Main/main.cxx to ensure that X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=890c26a9ee8ff43c050e70bc2af1697b8bd98fee;p=flightgear.git Move initial setup of cloud layers to Main/main.cxx to ensure that they are done only once, and ensure that all properties are untied in unbind(). --- diff --git a/src/Environment/environment_mgr.cxx b/src/Environment/environment_mgr.cxx index 61cfb69ee..6f82b95af 100644 --- a/src/Environment/environment_mgr.cxx +++ b/src/Environment/environment_mgr.cxx @@ -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 diff --git a/src/Environment/environment_mgr.hxx b/src/Environment/environment_mgr.hxx index 4caf6e22e..0ad652e71 100644 --- a/src/Environment/environment_mgr.hxx +++ b/src/Environment/environment_mgr.hxx @@ -45,6 +45,10 @@ class FGEnvironmentMgr : public FGSubsystem public: + enum { + MAX_CLOUD_LAYERS = 5 + }; + FGEnvironmentMgr (); virtual ~FGEnvironmentMgr ();