1
0
Fork 0

immediately fetch a metar if real-weather-fetch is re-enabled at runtime

This commit is contained in:
torsten 2009-06-08 19:39:37 +00:00 committed by Tim Moore
parent c56b2f0047
commit 6d12675161
2 changed files with 15 additions and 2 deletions

View file

@ -836,7 +836,8 @@ FGMetarFetcher::FGMetarFetcher() :
search_timer(0.0), search_timer(0.0),
error_timer(0.0), error_timer(0.0),
_stale_count(0), _stale_count(0),
_error_count(0) _error_count(0),
enabled(false)
{ {
longitude_n = fgGetNode( "/position/longitude-deg", true ); longitude_n = fgGetNode( "/position/longitude-deg", true );
latitude_n = fgGetNode( "/position/latitude-deg", true ); latitude_n = fgGetNode( "/position/latitude-deg", true );
@ -901,8 +902,19 @@ void FGMetarFetcher::update (double delta_time_sec)
_error_count = 0; _error_count = 0;
} }
if( enable_n->getBoolValue() == false ) if( enable_n->getBoolValue() == false ) {
enabled = false;
return; return;
}
// we were just enabled, reset all timers to
// trigger immediate metar fetch
if( !enabled ) {
search_timer = 0.0;
fetch_timer = 0.0;
error_timer = error_timer_sec;
enabled = true;
}
FGAirport * a = NULL; FGAirport * a = NULL;

View file

@ -249,6 +249,7 @@ private:
long _stale_count; long _stale_count;
long _error_count; long _error_count;
bool enabled;
}; };