]> git.mxchange.org Git - flightgear.git/blobdiff - src/Environment/environment_ctrl.cxx
Merge branch 'maint' into next
[flightgear.git] / src / Environment / environment_ctrl.cxx
index 8fb0ad8fea53b57073ee4b8bc483dc547e720ae8..72f6f09794ecf07bb8f231056566abb10a2e8c27 100644 (file)
 
 using std::sort;
 
-class AirportWithMetar : public FGPositioned::Filter
+class AirportWithMetar : public FGAirport::AirportFilter
 {
 public:
-  virtual bool pass(FGPositioned* aPos) const
+  virtual bool passAirport(FGAirport* aApt) const
   {
-    if ((aPos->type() < FGPositioned::AIRPORT) || (aPos->type() > FGPositioned::SEAPORT)) {
-      return false;
-    }
-    
-    FGAirport* apt = static_cast<FGAirport*>(aPos);
-    return apt->getMetar();
+    return aApt->getMetar();
   }
 };
 \f
@@ -964,7 +959,7 @@ FGMetarEnvironmentCtrl::update_metar_properties( const FGMetar *m )
 void
 FGMetarEnvironmentCtrl::thread_stop()
 {
-    request_queue.push( string() );    // ask thread to terminate
+    request_queue.push(NULL);  // ask thread to terminate
     thread->join();
 }
 
@@ -973,11 +968,11 @@ FGMetarEnvironmentCtrl::MetarThread::run()
 {
     while ( true )
     {
-        string icao = fetcher->request_queue.pop();
-        if (icao.empty())
+        FGAirport* apt = fetcher->request_queue.pop();
+        if (!apt)
             return;
-        SG_LOG( SG_GENERAL, SG_INFO, "Thread: fetch metar data = " << icao );
-        FGMetarResult result = fetcher->fetch_data( icao );
+        SG_LOG( SG_GENERAL, SG_INFO, "Thread: fetch metar data = " << apt->ident() );
+        FGMetarResult result = fetcher->fetch_data( apt );
         fetcher->result_queue.push( result );
     }
 }