Harald JOHNSEN:
this is the correction for the visibility bug/yasim crash. I've also made a little change that could help in the metar init.
This commit is contained in:
parent
e60223a952
commit
dcbc6369ac
1 changed files with 9 additions and 1 deletions
|
@ -326,6 +326,7 @@ FGMetarEnvironmentCtrl::FGMetarEnvironmentCtrl ()
|
||||||
proxy_auth( fgGetNode("/sim/presets/proxy/authentication", true) ),
|
proxy_auth( fgGetNode("/sim/presets/proxy/authentication", true) ),
|
||||||
metar_max_age( fgGetNode("/environment/params/metar-max-age-min", true) ),
|
metar_max_age( fgGetNode("/environment/params/metar-max-age-min", true) ),
|
||||||
_error_count( 0 ),
|
_error_count( 0 ),
|
||||||
|
_dt( 0.0 ),
|
||||||
_error_dt( 0.0 )
|
_error_dt( 0.0 )
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_THREADS) && ENABLE_THREADS
|
#if defined(ENABLE_THREADS) && ENABLE_THREADS
|
||||||
|
@ -394,6 +395,11 @@ FGMetarEnvironmentCtrl::init ()
|
||||||
= fgGetNode( "/position/latitude-deg", true );
|
= fgGetNode( "/position/latitude-deg", true );
|
||||||
|
|
||||||
bool found_metar = false;
|
bool found_metar = false;
|
||||||
|
long max_age = metar_max_age->getLongValue();
|
||||||
|
// Don't check max age during init so that we don't loop over a lot
|
||||||
|
// of airports metar if there is a problem.
|
||||||
|
// The update() calls will find a correct metar if things went wrong here
|
||||||
|
metar_max_age->setLongValue(60 * 24 * 7);
|
||||||
|
|
||||||
while ( !found_metar && (_error_count < 3) ) {
|
while ( !found_metar && (_error_count < 3) ) {
|
||||||
FGAirport a = globals->get_airports()
|
FGAirport a = globals->get_airports()
|
||||||
|
@ -418,6 +424,7 @@ FGMetarEnvironmentCtrl::init ()
|
||||||
globals->get_airports()->no_metar( a.getId() );
|
globals->get_airports()->no_metar( a.getId() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
metar_max_age->setLongValue(max_age);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -580,7 +587,8 @@ FGMetarEnvironmentCtrl::update_metar_properties( FGMetar *m )
|
||||||
|
|
||||||
fgSetString("/environment/metar/real-metar", m->getData());
|
fgSetString("/environment/metar/real-metar", m->getData());
|
||||||
// don't update with real weather when we use a custom weather scenario
|
// don't update with real weather when we use a custom weather scenario
|
||||||
if( strcmp(fgGetString("/environment/weather-scenario", "METAR"), "METAR") )
|
const char *current_scenario = fgGetString("/environment/weather-scenario", "METAR");
|
||||||
|
if( strcmp(current_scenario, "METAR") && strcmp(current_scenario, "none"))
|
||||||
return;
|
return;
|
||||||
fgSetString("/environment/metar/last-metar", m->getData());
|
fgSetString("/environment/metar/last-metar", m->getData());
|
||||||
fgSetString("/environment/metar/station-id", m->getId());
|
fgSetString("/environment/metar/station-id", m->getId());
|
||||||
|
|
Loading…
Add table
Reference in a new issue