]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/dynamics.hxx
Merge branch 'next' into durk-atc
[flightgear.git] / src / Airports / dynamics.hxx
index 0e5d6f4383e79cdf0257efe9a97b791ed6b558b7..d3dbedaa27b50256e600b5215632e7bf0cf1f1a3 100644 (file)
 #ifndef _AIRPORT_DYNAMICS_HXX_
 #define _AIRPORT_DYNAMICS_HXX_
 
-
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
-#include <simgear/xml/easyxml.hxx>
-
+#include <ATC/trafficcontrol.hxx>
 #include "parking.hxx"
 #include "groundnetwork.hxx"
 #include "runwayprefs.hxx"
-#include "trafficcontrol.hxx"
+#include "sidstar.hxx"
 
+// forward decls
 class FGAirport;
+class FGEnvironment;
 
 class FGAirportDynamics {
 
 private:
   FGAirport* _ap;
 
-  FGParkingVec       parkings;
-  FGRunwayPreference rwyPrefs;
-  FGGroundNetwork    groundNetwork;
-  FGTowerController  towerController;
+  FGParkingVec         parkings;
+  FGRunwayPreference   rwyPrefs;
+  FGSidStar            SIDs;
+  FGStartupController  startupController;
+  FGGroundNetwork      groundNetwork;
+  FGTowerController    towerController;
+  FGApproachController approachController;
 
   time_t lastUpdate;
-  string prevTrafficType;
+  std::string prevTrafficType;
   stringVec landing;
   stringVec takeoff;
   stringVec milActive, comActive, genActive, ulActive;
   stringVec *currentlyActive;
+  intVec freqAwos;     // </AWOS>
+  intVec freqUnicom;   // </UNICOM>
+  intVec freqClearance;// </CLEARANCE>
+  intVec freqGround;   // </GROUND>
+  intVec freqTower;    // </TOWER>
+  intVec freqApproach; // </APPROACH>
+
+  int atisSequenceIndex;
+  double atisSequenceTimeStamp;
+  
+  std::string chooseRunwayFallback();
+  bool innerGetActiveRunway(const std::string &trafficType, int action, std::string &runway, double heading);
+  std::string chooseRwyByHeading(stringVec rwys, double heading);
 
-  // Experimental keep a running average of wind dir and speed to prevent
-  // Erratic runway changes. 
-  // Note: I should add these to the copy constructor and assigment operator to be
-  // constistent
-  //double avWindHeading [10];
-  //double avWindSpeed   [10];
-
-  string chooseRunwayFallback();
+  double elevation;
 
 public:
   FGAirportDynamics(FGAirport* ap);
-  FGAirportDynamics(const FGAirportDynamics &other);
   ~FGAirportDynamics();
 
+  void addAwosFreq     (int val) { freqAwos.push_back(val);      };
+  void addUnicomFreq   (int val) { freqUnicom.push_back(val);    };
+  void addClearanceFreq(int val) { freqClearance.push_back(val); };
+  void addGroundFreq   (int val) { freqGround.push_back(val);    };
+  void addTowerFreq    (int val) { freqTower.push_back(val);     };
+  void addApproachFreq (int val) { freqApproach.push_back(val);  };
 
   void init();
   double getLongitude() const; 
@@ -76,7 +86,7 @@ public:
   double getElevation() const; 
   const string& getId() const; 
   
-  void getActiveRunway(const string& trafficType, int action, string& runway);
+  void getActiveRunway(const string& trafficType, int action, string& runway, double heading);
 
   void addParking(FGParking& park);
   bool getAvailableParking(double *lat, double *lon, 
@@ -91,9 +101,25 @@ public:
   //const string &getName() const { return _name;};
   // Returns degrees
 
-  FGGroundNetwork   *getGroundNetwork()   { return &groundNetwork; };
-  FGTowerController *getTowerController() { return &towerController; };
+  // Departure / Arrival procedures
+  FGSidStar * getSIDs() { return &SIDs; };
+  FGAIFlightPlan * getSID(string activeRunway, double heading);
+
+
+  // ATC related functions. 
+  FGStartupController    *getStartupController()    { return &startupController; };
+  FGGroundNetwork        *getGroundNetwork()        { return &groundNetwork; };
+  FGTowerController      *getTowerController()      { return &towerController; };
+  FGApproachController   *getApproachController()   { return &approachController; };
+
+  int getGroundFrequency(unsigned leg);
+  int getTowerFrequency  (unsigned nr);
   
+  /// get current ATIS sequence letter
+  const std::string getAtisSequence();
+
+  /// get the current ATIS sequence number, updating it if necessary
+  int updateAtisSequence(int interval, bool forceUpdate);
 
   void setRwyUse(const FGRunwayPreference& ref);
 };