From 4564dbd95e65e99e925eac1283c98d551e00038b Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Mon, 9 Mar 2015 12:24:36 +0100 Subject: [PATCH] Live weather: ensure valid flag is set correctly --- src/Environment/metarproperties.cxx | 4 ++++ src/Environment/metarproperties.hxx | 1 + src/Environment/realwx_ctrl.cxx | 1 + 3 files changed, 6 insertions(+) diff --git a/src/Environment/metarproperties.cxx b/src/Environment/metarproperties.cxx index 632bdefa4..97b94da0a 100644 --- a/src/Environment/metarproperties.cxx +++ b/src/Environment/metarproperties.cxx @@ -190,6 +190,10 @@ MetarProperties::~MetarProperties() delete _magneticVariation; } +void MetarProperties::invalidate() +{ + _metarValidNode->setBoolValue(false); +} static const double thickness_value[] = { 0, 65, 600, 750, 1000 }; diff --git a/src/Environment/metarproperties.hxx b/src/Environment/metarproperties.hxx index 319f479f9..6404642f3 100644 --- a/src/Environment/metarproperties.hxx +++ b/src/Environment/metarproperties.hxx @@ -44,6 +44,7 @@ public: virtual const std::string & getStationId() const { return _station_id; } virtual void setStationId( const std::string & value ); virtual void setMetar(SGSharedPtr m); + virtual void invalidate(); private: const char * get_metar() const; diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx index afa41c62b..04d79ab38 100644 --- a/src/Environment/realwx_ctrl.cxx +++ b/src/Environment/realwx_ctrl.cxx @@ -112,6 +112,7 @@ void LiveMetarProperties::update( double dt ) _pollingTimer -= dt; if( _timeToLive <= 0.0 ) { _timeToLive = 0.0; + invalidate(); std::string stationId = getStationId(); if( stationId.empty() ) return; if( _pollingTimer > 0.0 ) return;