#include <simgear/debug/logstream.hxx>
#include <simgear/route/waypoint.hxx>
+#include <Airports/simple.hxx>
#include <Airports/dynamics.hxx>
#include <AIModel/AIAircraft.hxx>
double radius, int leg,
FGAIAircraft * aircraft)
{
+ init();
TrafficVectorIterator i = activeTraffic.begin();
// Search search if the current id alread has an entry
// This might be faster using a map instead of a vector, but let's start by taking a safe route
}
}
-void FGGroundNetwork::update(int id, double lat, double lon,
- double heading, double speed, double alt,
- double dt)
+void FGGroundNetwork::updateAircraftInformation(int id, double lat, double lon,
+ double heading, double speed, double alt,
+ double dt)
{
// Check whether aircraft are on hold due to a preceding pushback. If so, make sure to
// Transmit air-to-ground "Ready to taxi request:
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;
+ }
+
}
+
}
/**