1
0
Fork 0

Switch to time based detection of autumn. The sun latitude detection is just too flaky.

This commit is contained in:
Erik Hofman 2020-11-11 14:38:45 +01:00
parent cc0a683627
commit caac9fbd75
2 changed files with 8 additions and 6 deletions

View file

@ -64,6 +64,7 @@ FGClimate::FGClimate()
void FGClimate::init()
{
_monthNode = fgGetNode("/sim/time/utc/month", true);
_metarSnowLevelNode = fgGetNode("/environment/params/metar-updates-snow-level", true);
_positionLatitudeNode = fgGetNode("/position/latitude-deg", true);
@ -154,12 +155,12 @@ void FGClimate::update(double dt)
{
if (diff_pos > 1.0) reinit();
_is_autumn = false;
if ((latitude_deg*_sun_latitude_deg < 0.0) // autumn + spring
&& (_adj_latitude_deg > _prev_lat)) // autumn
{
_is_autumn = true;
}
double north = latitude_deg >= 0.0 ? 1.0 : -1.0; // hemisphere
if (north) {
_is_autumn = (_monthNode->getIntValue() > 6) ? true : false;
} else {
_is_autumn = (_monthNode->getIntValue() <= 6) ? true : false;
}
_prev_lat = _adj_latitude_deg;
_prev_lon = _adj_longitude_deg;

View file

@ -97,6 +97,7 @@ private:
SGPropertyNode_ptr _rootNode;
simgear::TiedPropertyList _tiedProperties;
SGPropertyNode_ptr _monthNode;
SGPropertyNode_ptr _metarSnowLevelNode;
SGPropertyNode_ptr _positionLatitudeNode;
SGPropertyNode_ptr _positionLongitudeNode;