From cef9eb3d73e16efca914a353c0c1e83e049ccb17 Mon Sep 17 00:00:00 2001 From: torsten Date: Fri, 22 May 2009 18:19:25 +0000 Subject: [PATCH] Clouds in scenario none and metar were above 0ft not above ground elevation, which lead to clouds at or below ground level for high altitude airfields. Reason: For the scenario none, the station_elevation was computed before the terrain was loaded, for METAR scenario station_elevation was not computed at all. --- src/Environment/environment_mgr.cxx | 14 ++++++++++++++ src/Environment/fgclouds.cxx | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/Environment/environment_mgr.cxx b/src/Environment/environment_mgr.cxx index 7b4f91e1f..2c9cefc95 100644 --- a/src/Environment/environment_mgr.cxx +++ b/src/Environment/environment_mgr.cxx @@ -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(), diff --git a/src/Environment/fgclouds.cxx b/src/Environment/fgclouds.cxx index 772d423e8..10f4887e5 100644 --- a/src/Environment/fgclouds.cxx +++ b/src/Environment/fgclouds.cxx @@ -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 != "" ) { -- 2.39.5