Switch to time based detection of autumn. The sun latitude detection is just too flaky.
This commit is contained in:
parent
cc0a683627
commit
caac9fbd75
2 changed files with 8 additions and 6 deletions
|
@ -64,6 +64,7 @@ FGClimate::FGClimate()
|
||||||
|
|
||||||
void FGClimate::init()
|
void FGClimate::init()
|
||||||
{
|
{
|
||||||
|
_monthNode = fgGetNode("/sim/time/utc/month", true);
|
||||||
_metarSnowLevelNode = fgGetNode("/environment/params/metar-updates-snow-level", true);
|
_metarSnowLevelNode = fgGetNode("/environment/params/metar-updates-snow-level", true);
|
||||||
|
|
||||||
_positionLatitudeNode = fgGetNode("/position/latitude-deg", true);
|
_positionLatitudeNode = fgGetNode("/position/latitude-deg", true);
|
||||||
|
@ -154,12 +155,12 @@ void FGClimate::update(double dt)
|
||||||
{
|
{
|
||||||
if (diff_pos > 1.0) reinit();
|
if (diff_pos > 1.0) reinit();
|
||||||
|
|
||||||
_is_autumn = false;
|
double north = latitude_deg >= 0.0 ? 1.0 : -1.0; // hemisphere
|
||||||
if ((latitude_deg*_sun_latitude_deg < 0.0) // autumn + spring
|
if (north) {
|
||||||
&& (_adj_latitude_deg > _prev_lat)) // autumn
|
_is_autumn = (_monthNode->getIntValue() > 6) ? true : false;
|
||||||
{
|
} else {
|
||||||
_is_autumn = true;
|
_is_autumn = (_monthNode->getIntValue() <= 6) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_prev_lat = _adj_latitude_deg;
|
_prev_lat = _adj_latitude_deg;
|
||||||
_prev_lon = _adj_longitude_deg;
|
_prev_lon = _adj_longitude_deg;
|
||||||
|
|
|
@ -97,6 +97,7 @@ private:
|
||||||
SGPropertyNode_ptr _rootNode;
|
SGPropertyNode_ptr _rootNode;
|
||||||
simgear::TiedPropertyList _tiedProperties;
|
simgear::TiedPropertyList _tiedProperties;
|
||||||
|
|
||||||
|
SGPropertyNode_ptr _monthNode;
|
||||||
SGPropertyNode_ptr _metarSnowLevelNode;
|
SGPropertyNode_ptr _metarSnowLevelNode;
|
||||||
SGPropertyNode_ptr _positionLatitudeNode;
|
SGPropertyNode_ptr _positionLatitudeNode;
|
||||||
SGPropertyNode_ptr _positionLongitudeNode;
|
SGPropertyNode_ptr _positionLongitudeNode;
|
||||||
|
|
Loading…
Add table
Reference in a new issue