]> git.mxchange.org Git - flightgear.git/commitdiff
Clouds in scenario none and metar were above 0ft not above ground elevation, which...
authortorsten <torsten>
Fri, 22 May 2009 18:19:25 +0000 (18:19 +0000)
committerTim Moore <timoore@redhat.com>
Tue, 2 Jun 2009 22:18:54 +0000 (00:18 +0200)
src/Environment/environment_mgr.cxx
src/Environment/fgclouds.cxx

index 7b4f91e1fe6b208932a60346d1476b61e8e94878..2c9cefc95285422297d9fd64df1e1cf1d902a852 100644 (file)
@@ -266,11 +266,25 @@ FGEnvironmentMgr::unbind ()
   fgUntie("/environment/turbulence/use-cloud-turbulence");
 }
 
+/* probably this should be a class member? */
+static bool scenery_loaded = false;
+
 void
 FGEnvironmentMgr::update (double dt)
 {
   SGSubsystemGroup::update(dt);
 
+  {
+    /*
+      re set the scenario after the scenery has been loaded
+      (raising edge of sim/sceneryloaded)
+      so that ground elevation can be computed.
+    */
+    bool b = fgGetBool( "sim/sceneryloaded" );
+    if( !scenery_loaded && b )
+      fgClouds->set_scenario( fgClouds->get_scenario() );
+    scenery_loaded = b;
+  }
                                // FIXME: the FDMs should update themselves
   current_aircraft.fdm_state
     ->set_Velocities_Local_Airmass(_environment->get_wind_from_north_fps(),
index 772d423e837363f9f7e26fb36cbe8458775c651c..10f4887e53450b3e108e1d11ee597ce3147b078c 100644 (file)
@@ -493,6 +493,8 @@ void FGClouds::set_scenario(const char * sc) {
         }
                 
         if( scenario == "METAR" ) {
+            // needed here to compute station_elevation_ft
+            buildScenario( scenario );
             string realMetar = fgGetString("/environment/metar/real-metar", "");
 
             if( realMetar != "" ) {