]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/dynamics.cxx
Expose more things to Nasal for FMSs in particular - still work in progress.
[flightgear.git] / src / Airports / dynamics.cxx
index 9cbf9f6facfe84b876e62495e60a41c9d325467a..5a077968d1cad8f7bbc1d9ff456fd7b6e108e452 100644 (file)
@@ -51,9 +51,12 @@ using std::random_shuffle;
 
 FGAirportDynamics::FGAirportDynamics(FGAirport * ap):
     _ap(ap), rwyPrefs(ap), SIDs(ap),
+        startupController    (this),
+    towerController      (this),
+    approachController   (this),
     atisSequenceIndex(-1),
     atisSequenceTimeStamp(0.0)
-    startupController(this);
+
 {
     lastUpdate = 0;
 }
@@ -99,6 +102,7 @@ bool FGAirportDynamics::getAvailableParking(double *lat, double *lon,
         //cerr << "Could not find parking spot at " << _ap->getId() << endl;
         *lat = _ap->getLatitude();
         *lon = _ap->getLongitude();
+        * gateId = -1;
         *heading = 0;
         found = true;
     } else {
@@ -493,25 +497,24 @@ const string & FGAirportDynamics::getId() const
 int FGAirportDynamics::getGroundFrequency(unsigned leg)
 {
     //return freqGround.size() ? freqGround[0] : 0; };
+    //cerr << "Getting frequency for : " << leg << endl;
     int groundFreq = 0;
-    if (leg < 2) {
+    if (leg < 1) {
         SG_LOG(SG_ATC, SG_ALERT,
-               "Leg value is smaller than two at " << SG_ORIGIN);
+               "Leg value is smaller than one at " << SG_ORIGIN);
     }
     if (freqGround.size() == 0) {
         return 0;
     }
-    if ((freqGround.size() > leg - 1) && (leg > 1)) {
-        groundFreq = freqGround[leg - 1];
-    }
-    if ((freqGround.size() < leg - 1) && (leg > 1)) {
+
+    if ((freqGround.size() < leg) && (leg > 0)) {
         groundFreq =
-            (freqGround.size() <
+            (freqGround.size() <=
              (leg - 1)) ? freqGround[freqGround.size() -
-                                     1] : freqGround[leg - 2];
+                                     1] : freqGround[leg - 1];
     }
-    if ((freqGround.size() >= leg - 1) && (leg > 1)) {
-        groundFreq = freqGround[leg - 2];
+    if ((freqGround.size() >= leg) && (leg > 0)) {
+        groundFreq = freqGround[leg - 1];
     }
     return groundFreq;
 }