]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/groundnetwork.cxx
First attempt at support for loading airport XML files via a command
[flightgear.git] / src / Airports / groundnetwork.cxx
index 011acb866d513014d9023dd164be137047255eb6..2fb8127a5f675b4547b05f33b7ac420c29de6a92 100644 (file)
@@ -30,6 +30,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/route/waypoint.hxx>
 
+#include <Airports/simple.hxx>
 #include <Airports/dynamics.hxx>
 
 #include <AIModel/AIAircraft.hxx>
@@ -553,35 +554,46 @@ void FGGroundNetwork::update(int id, double lat, double lon,
     current->clearResolveCircularWait();
     current->setWaitsForId(0);
     checkSpeedAdjustment(id, lat, lon, heading, speed, alt);
-    checkHoldPosition(id, lat, lon, heading, speed, alt);
-    if (checkForCircularWaits(id)) {
-        i->setResolveCircularWait();
-    }
     bool needsTaxiClearance = current->getAircraft()->getTaxiClearanceRequest();
-    int state = current->getState();
-    time_t now = time(NULL) + fgGetLong("/sim/time/warp");
-    if ((now - lastTransmission) > 15) {
-        available = true;
-    }
-    if (needsTaxiClearance && available) {
-         transmit(&(*current), MSG_REQUEST_TAXI_CLEARANCE, ATC_AIR_TO_GROUND);
-         current->getAircraft()->setTaxiClearanceRequest(false);
-         current->setState(3);
-         lastTransmission = now;
-         available = false;
-    }
-    if ((state == 3) && available) {
-         transmit(&(*current), MSG_ISSUE_TAXI_CLEARANCE, ATC_GROUND_TO_AIR);
-         current->setState(4);
-         lastTransmission = now;
-         available = false;
-    }
-    if ((state == 4) && available) {
-         transmit(&(*current), MSG_ACKNOWLEDGE_TAXI_CLEARANCE, ATC_AIR_TO_GROUND);
-         current->setState(0);
-         lastTransmission = now;
-         available = false;
+    if (!needsTaxiClearance) {
+        checkHoldPosition(id, lat, lon, heading, speed, alt);
+        if (checkForCircularWaits(id)) {
+            i->setResolveCircularWait();
+        }
+    } else {
+        current->setHoldPosition(true);
+        int state = current->getState();
+        time_t now = time(NULL) + fgGetLong("/sim/time/warp");
+        if ((now - lastTransmission) > 15) {
+            available = true;
+        }
+        if ((state < 3) && available) {
+             transmit(&(*current), MSG_REQUEST_TAXI_CLEARANCE, ATC_AIR_TO_GROUND);
+             current->setState(3);
+             lastTransmission = now;
+             available = false;
+        }
+        if ((state == 3) && available) {
+            transmit(&(*current), MSG_ISSUE_TAXI_CLEARANCE, ATC_GROUND_TO_AIR);
+            current->setState(4);
+            lastTransmission = now;
+            available = false;
+        }
+        if ((state == 4) && available) {
+            transmit(&(*current), MSG_ACKNOWLEDGE_TAXI_CLEARANCE, ATC_AIR_TO_GROUND);
+            current->setState(5);
+            lastTransmission = now;
+            available = false;
+        }
+        if ((state == 5) && available) {
+            current->setState(0);
+            current->getAircraft()->setTaxiClearanceRequest(false);
+            current->setHoldPosition(true);
+            available = false;
+        }
+
     }
+
 }
 
 /**