else
groundOffset = 0;
- fp = 0;
- controller = 0;
- prevController = 0;
+ fp = 0;
+ controller = 0;
+ prevController = 0;
+ towerController = 0;
dt_count = 0;
dt_elev_count = 0;
use_perf_vs = true;
_performance = 0; //TODO initialize to JET_TRANSPORT from PerformanceDB
dt = 0;
+ scheduledForTakeoff = false;
}
}
}
+void FGAIAircraft::scheduleForATCTowerDepartureControl() {
+ if (!scheduledForTakeoff) {
+ int leg = fp->getLeg();
+ if (trafficRef) {
+ if (trafficRef->getDepartureAirport()->getDynamics()) {
+ towerController = trafficRef->getDepartureAirport()->getDynamics()->getTowerController();
+ } else {
+ cerr << "Error: Could not find Dynamics at airport : " << trafficRef->getDepartureAirport()->getId() << endl;
+ }
+ if (towerController) {
+ towerController->announcePosition(getID(), fp, fp->getCurrentWaypoint()->getRouteIndex(),
+ _getLatitude(), _getLongitude(), hdg, speed, altitude_ft,
+ trafficRef->getRadius(), leg, this);
+ }
+ }
+ }
+ scheduledForTakeoff = true;
+}
+
// Process ATC instructions and report back
void FGAIAircraft::processATC(FGATCInstruction instruction) {
if (prev->contains("legend")) {
fp->incrementLeg();
}
+ if (prev->contains(string("DepartureHold"))) {
+ scheduleForATCTowerDepartureControl();
+ }
// This is the last taxi waypoint, and marks the the end of the flight plan
// so, the schedule should update and wait for the next departure time.