From e2c4a83040d7d39bf327bf72b51947708d6f517b Mon Sep 17 00:00:00 2001 From: daveluff Date: Sat, 20 Mar 2004 04:12:05 +0000 Subject: [PATCH] Some more tweaks to the landing clearance code --- src/ATC/tower.cxx | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/src/ATC/tower.cxx b/src/ATC/tower.cxx index dff977f6f..3f3f766fd 100644 --- a/src/ATC/tower.cxx +++ b/src/ATC/tower.cxx @@ -187,6 +187,8 @@ GO-AROUND is instructed very late at < 12s to landing - possibly make more depen Need to make clear when TowerPlaneRecs do or don't get deleted in RemoveFromCircuitList etc. (MINOR until I misuse it - then CRITICAL!) FGTower::RemoveAllUserDialogOptions() really ought to be replaced by an ATCDialog::clear_entries() function. (MINOR - efficiency). + +At the moment planes in the lists are not guaranteed to always have a sensible ETA - it should be set as part of AddList functions, and lists should only be accessed this way. (FAIRLY MAJOR). *******************************************/ FGTower::FGTower() { @@ -1051,7 +1053,15 @@ void FGTower::CheckCircuitList(double dt) { t->planePtr->RegisterTransmission(13); } } else if(!t->clearedToLand) { - if(t->nextOnRwy) { + // The whip through the appList is a hack since currently t->nextOnRwy doesn't always work + // TODO - fix this! + bool cf = false; + for(tower_plane_rec_list_iterator twrItr = appList.begin(); twrItr != appList.end(); twrItr++) { + if((*twrItr)->eta < t->eta) { + cf = true; + } + } + if(t->nextOnRwy && !cf) { if(!rwyList.size()) { string trns = t->plane.callsign; trns += " Cleared to land"; @@ -1166,6 +1176,7 @@ void FGTower::CheckApproachList(double dt) { } else { // TODO - set/update the position if it's an AI plane } + doThresholdETACalc(); // We need this here because planes in the lists are not guaranteed to *always* have the correct ETA //cout << "eta is " << t->eta << ", rwy is " << (rwyList.size() ? "occupied " : "clear ") << '\n'; if(t->eta < 12 && rwyList.size() && !(t->instructedToGoAround)) { // TODO - need to make this more sophisticated @@ -1191,10 +1202,32 @@ void FGTower::CheckApproachList(double dt) { // TODO - add Go-around ack to comm options, // remove report rwy vacated. (possibly). } - } - if(t->nextOnRwy && !(t->clearedToLand) && !(t->instructedToGoAround)) { - // check distance away and whether runway occupied - // and schedule transmission if necessary + } else if(t->eta < 90 && !t->clearedToLand) { + //doThresholdETACalc(); + doThresholdUseOrder(); + // The whip through the appList is a hack since currently t->nextOnRwy doesn't always work + // TODO - fix this! + bool cf = false; + for(tower_plane_rec_list_iterator twrItr = appList.begin(); twrItr != appList.end(); twrItr++) { + if((*twrItr)->eta < t->eta) { + cf = true; + } + } + if(t->nextOnRwy && !cf) { + if(!rwyList.size()) { + string trns = t->plane.callsign; + trns += " Cleared to land"; + pending_transmission = trns; + Transmit(); + //if(t->isUser) cout << "Transmitting cleared to Land!!!\n"; + t->clearedToLand = true; + if(!t->isUser) { + t->planePtr->RegisterTransmission(7); + } + } + } else { + //if(t->isUser) cout << "Not next\n"; + } } // Check for landing... -- 2.39.5