]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/dynamics.cxx
Conditional compilation of ATCDCL module. Use --disable-atcdcl to try building flight...
[flightgear.git] / src / Airports / dynamics.cxx
index fe8079075a0a6216a2d9bce5de31991350163ef3..3e658a1473aa5effe73f158c7fe181d1e2c797b0 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <simgear/compiler.h>
 
-#include <plib/sg.h>
 #include <plib/ul.h>
 
 #include <Environment/environment_mgr.hxx>
@@ -537,20 +536,20 @@ const string& FGAirportDynamics::getId() const {
 // so that at least I can start working on assigning different frequencies to different
 // operations.
 
-int FGAirportDynamics::getGroundFrequency(int leg) { 
+int FGAirportDynamics::getGroundFrequency(unsigned leg) { 
      //return freqGround.size() ? freqGround[0] : 0; };
-     int groundFreq;
+     int groundFreq = 0;
      if (leg < 2) {
          SG_LOG(SG_ATC, SG_ALERT, "Leg value is smaller than two at " << SG_ORIGIN);
      }
      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];
@@ -561,4 +560,4 @@ int FGAirportDynamics::getGroundFrequency(int leg) {
 FGAIFlightPlan *FGAirportDynamics::getSID(string activeRunway, double heading)
 {
    return SIDs.getBest(activeRunway, heading);
-}
\ No newline at end of file
+}