From 4894497ce2a97af4dbff69897b0f619fa6c4c1a1 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sun, 7 Feb 2021 16:03:08 +0100 Subject: [PATCH] Update the way the snow thickness is calculated, otherwise there will never be snow --- src/Environment/climate.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Environment/climate.cxx b/src/Environment/climate.cxx index 611f79c14..11f32bb26 100644 --- a/src/Environment/climate.cxx +++ b/src/Environment/climate.cxx @@ -867,21 +867,21 @@ void FGClimate::set_environment() } else { - double wetness = std::max(_gl.precipitation - 20.0, 0.0); - wetness = powf(sin(atan(12.0*wetness/990.0)), 2.0); + double wetness = 12.0*_gl.precipitation/990.0; + wetness = pow(sin(atan(SGD_PI*wetness)), 2.0); - _set(_dust_cover, 0.0); + _dust_cover = 0.0; - if (_gl.temperature_mean < -5.0) { - _set(_snow_thickness, wetness); + if (_gl.temperature_mean < 5.0) { + _snow_thickness = wetness; } else { - _set(_snow_thickness, 0.0); + _snow_thickness = 0.0; } - if (_gl.temperature_mean > 0.0) { - _set(_wetness, pow(wetness, 2.0)); + if (_gl.temperature_mean < 0.0) { + _wetness = 0.0; } else { - _set(_wetness, 0.0); + _wetness = wetness; } double cover = std::min(_gl.precipitation_annual, 990.0)/990.0;