]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATCDCL/atis.cxx
NavDisplay: fix update lag when switching range or centre.
[flightgear.git] / src / ATCDCL / atis.cxx
index 53973a7a752b3272085fa85b1edd12cc9eabe9cd..b87369e1a01b7c41c6a91c96cc9a89d801e34ff0 100644 (file)
@@ -34,6 +34,8 @@
 #include "atis_lexicon.hxx"
 
 #include <simgear/compiler.h>
+#include <simgear/math/sg_random.h>
+#include <simgear/misc/sg_path.hxx>
 
 #include <stdlib.h> // atoi()
 #include <stdio.h>  // sprintf
@@ -44,9 +46,6 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/case_conv.hpp>
 
-
-#include <simgear/misc/sg_path.hxx>
-
 #include <Environment/environment_mgr.hxx>
 #include <Environment/environment.hxx>
 #include <Environment/atmosphere.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/globals.hxx>
 #include <Airports/runways.hxx>
+#include <Airports/dynamics.hxx>
 
 
-#include "commlist.hxx"
 #include "ATCutils.hxx"
 #include "ATCmgr.hxx"
 
+using std::string;
+using std::map;
 using std::cout;
 using std::cout;
 using boost::ref;
@@ -75,7 +76,14 @@ FGATIS::FGATIS() :
   _prev_display(0),
   refname("atis")
 {
-  _vPtr = globals->get_ATC_mgr()->GetVoicePointer(ATIS);
+  FGATCMgr* pAtcMgr = globals->get_ATC_mgr();
+  if (!pAtcMgr)
+  {
+      SG_LOG(SG_ATC, SG_ALERT, "ERROR! No ATC manager! Oops...");
+      _vPtr = NULL;
+  }
+  else
+      _vPtr = pAtcMgr->GetVoicePointer(ATIS);
   _voiceOK = (_vPtr == NULL ? false : true);
   if (!(_type != ATIS || _type == AWOS)) {
        SG_LOG(SG_ATC, SG_ALERT, "ERROR - _type not ATIS or AWOS in atis.cxx");
@@ -241,12 +249,12 @@ int FGATIS::GenTransmission(const int regen, const int special) {
   string BRK = ".\n";
   string PAUSE = " / ";
 
-  double tstamp = atof(fgGetString("sim/time/elapsed-sec"));
   int interval = _type == ATIS ?
         ATIS_interval   // ATIS updated hourly
       : 2*minute;      // AWOS updated more frequently
-  int sequence = current_commlist->GetAtisSequence(ident, 
-                       tstamp, interval, special);
+
+  FGAirport* apt = FGAirport::findByIdent(ident);
+  int sequence = apt->getDynamics()->updateAtisSequence(interval, special);
   if (!regen && sequence > LTRS) {
 //xx      if (msg_OK) cout << "ATIS:  no change: " << sequence << endl;
 //xx      msg_time = cur_time;