]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/dynamics.cxx
testair.cxx is a 21 lines long, obsolete test application. After removing
[flightgear.git] / src / Airports / dynamics.cxx
index 34a6dce8ad71d9ca8693ec477f22071168624ed6..8fd14162b8627bc0d4d313ba8862c8aef14f8c11 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <simgear/compiler.h>
 
-#include <plib/sg.h>
 #include <plib/ul.h>
 
 #include <Environment/environment_mgr.hxx>
@@ -52,7 +51,7 @@ using std::random_shuffle;
 #include "dynamics.hxx"
 
 FGAirportDynamics::FGAirportDynamics(FGAirport* ap) :
-  _ap(ap), rwyPrefs(ap) {
+  _ap(ap), rwyPrefs(ap), SIDs(ap) {
   lastUpdate = 0;
 
   // For testing only. This needs to be refined when we move ATIS functionality over.
@@ -61,7 +60,8 @@ FGAirportDynamics::FGAirportDynamics(FGAirport* ap) :
 
 // Note that the ground network should also be copied
 FGAirportDynamics::FGAirportDynamics(const FGAirportDynamics& other) :
-  rwyPrefs(other.rwyPrefs)
+  rwyPrefs(other.rwyPrefs),
+  SIDs(other.SIDs)
 {
   for (FGParkingVecConstIterator ip= other.parkings.begin(); ip != other.parkings.end(); ip++)
     parkings.push_back(*(ip));
@@ -545,14 +545,19 @@ int FGAirportDynamics::getGroundFrequency(int leg) {
      if (freqGround.size() == 0) {
          return 0;
      }
-     if ((freqGround.size() >= leg-1) && (leg > 1)) {
+     if ((freqGround.size() > leg-1) && (leg > 1)) {
           groundFreq =  freqGround[leg-1];
      }
      if ((freqGround.size() < leg-1) && (leg > 1)) {
-          groundFreq = (freqGround.size() < (leg-2)) ? freqGround[freqGround.size()-1] : freqGround[leg-2];
+          groundFreq = (freqGround.size() < (leg-1)) ? freqGround[freqGround.size()-1] : freqGround[leg-2];
      }
      if ((freqGround.size() >= leg-1) && (leg > 1)) {
           groundFreq = freqGround[leg-2];
      }
     return groundFreq;
-}
\ No newline at end of file
+}
+
+FGAIFlightPlan *FGAirportDynamics::getSID(string activeRunway, double heading)
+{
+   return SIDs.getBest(activeRunway, heading);
+}