]> git.mxchange.org Git - flightgear.git/blobdiff - src/Environment/fgclouds.cxx
Fix bug 191, uninitialised HUD color.
[flightgear.git] / src / Environment / fgclouds.cxx
index f58d324f407e373620a0e7a2a3368606ee195377..70f7997c433063cd55195fab8b6ca5dd6a2fba24 100644 (file)
@@ -24,6 +24,7 @@
 #  include "config.h"
 #endif
 
+#include <cstring>
 #include <Main/fg_props.hxx>
 
 #include <simgear/constants.h>
@@ -65,7 +66,7 @@ void FGClouds::set_update_event(int count) {
 
 void FGClouds::init(void) {
        if( snd_lightning == NULL ) {
-               snd_lightning = new SGSoundSample(globals->get_fg_root().c_str(), "Sounds/thunder.wav");
+               snd_lightning = new SGSoundSample("Sounds/thunder.wav", SGPath());
                snd_lightning->set_max_dist(7000.0f);
                snd_lightning->set_reference_dist(3000.0f);
                SGSoundMgr *smgr = globals->get_soundmgr();
@@ -278,12 +279,9 @@ void FGClouds::buildCloudLayers(void) {
 
        //double wind_speed_kt   = metar_root->getDoubleValue("wind-speed-kt");
        double temperature_degc  = metar_root->getDoubleValue("temperature-sea-level-degc");
-       double dewpoint_degc     = metar_root->getDoubleValue("dewpoint-sea-level-degc");
-       double pressure_mb              = metar_root->getDoubleValue("pressure-sea-level-inhg") * SG_INHG_TO_PA / 100.0;
-
-       double dewp = pow(10.0, 7.5 * dewpoint_degc / (237.7 + dewpoint_degc));
-       double temp = pow(10.0, 7.5 * temperature_degc / (237.7 + temperature_degc));
-       double rel_humidity = dewp * 100 / temp;
+       double dewpoint_degc     = metar_root->getDoubleValue("dewpoint-sea-level-degc");
+       double pressure_mb       = metar_root->getDoubleValue("pressure-sea-level-inhg") * SG_INHG_TO_PA / 100.0;
+       double rel_humidity      = metar_root->getDoubleValue("relative-humidity");
 
        // formule d'Epsy, base d'un cumulus
        double cumulus_base = 122.0 * (temperature_degc - dewpoint_degc);
@@ -294,7 +292,7 @@ void FGClouds::buildCloudLayers(void) {
 
                double alt_ft = cloud_root->getDoubleValue("elevation-ft");
                double alt_m = alt_ft * SG_FEET_TO_METER;
-                string coverage = cloud_root->getStringValue("coverage");
+               string coverage = cloud_root->getStringValue("coverage");
                 
                double coverage_norm = 0.0;
                if( coverage == "few" )
@@ -336,6 +334,7 @@ void FGClouds::buildCloudLayers(void) {
                        }
                }
                 
+               cloud_root->setStringValue("layer-type",layer_type);
                buildLayer(iLayer, layer_type, alt_m, coverage_norm);
        }
 }