From ba13669d3239bf641ddf7a22f3fa2a2a25f6fe8f Mon Sep 17 00:00:00 2001 From: ehofman Date: Tue, 22 Feb 2005 18:12:32 +0000 Subject: [PATCH] Add the ability to set the minimum allowed age for metar reports. --- src/Environment/environment_ctrl.cxx | 4 +++- src/Environment/environment_ctrl.hxx | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Environment/environment_ctrl.cxx b/src/Environment/environment_ctrl.cxx index 21fb708e6..4a7b24732 100644 --- a/src/Environment/environment_ctrl.cxx +++ b/src/Environment/environment_ctrl.cxx @@ -324,6 +324,7 @@ FGMetarEnvironmentCtrl::FGMetarEnvironmentCtrl () proxy_host( fgGetNode("/sim/presets/proxy/host", true) ), proxy_port( fgGetNode("/sim/presets/proxy/port", true) ), proxy_auth( fgGetNode("/sim/presets/proxy/authentication", true) ), + metar_max_age( fgGetNode("/environment/params/metar-max-age-min", true) ), _error_count( 0 ), _error_dt( 0.0 ) { @@ -543,7 +544,8 @@ FGMetarEnvironmentCtrl::fetch_data( const string &icao ) string port = proxy_port->getStringValue(); result.m = new FGMetar( icao, host, port, auth); - if (result.m->getAge_min() > 4 * 60) { + long max_age = metar_max_age->getLongValue(); + if (max_age && result.m->getAge_min() > max_age) { SG_LOG( SG_GENERAL, SG_WARN, "METAR data too old"); delete result.m; result.m = NULL; diff --git a/src/Environment/environment_ctrl.hxx b/src/Environment/environment_ctrl.hxx index b48ee5f96..a08c11a9a 100644 --- a/src/Environment/environment_ctrl.hxx +++ b/src/Environment/environment_ctrl.hxx @@ -177,6 +177,7 @@ private: SGPropertyNode *proxy_host; SGPropertyNode *proxy_port; SGPropertyNode *proxy_auth; + SGPropertyNode *metar_max_age; FGMetarResult fetch_data( const string &icao ); virtual void update_metar_properties( FGMetar *m );