From fc36c51e893ed175c4fc5f1617bedf7251f65f7b Mon Sep 17 00:00:00 2001 From: daveluff Date: Sat, 20 Mar 2004 02:55:25 +0000 Subject: [PATCH] Slightly more robust handling of runway vacation --- src/ATC/tower.cxx | 19 +++++++++++++++++-- src/ATC/tower.hxx | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ATC/tower.cxx b/src/ATC/tower.cxx index a9e2ba709..dff977f6f 100644 --- a/src/ATC/tower.cxx +++ b/src/ATC/tower.cxx @@ -682,7 +682,7 @@ void FGTower::ProcessDownwindReport(TowerPlaneRec* t) { void FGTower::ProcessRunwayVacatedReport(TowerPlaneRec* t) { //cout << "Processing rwy vacated...\n"; - current_atcdialog->remove_entry(ident, USER_REPORT_GOING_AROUND, TOWER); + if(t->isUser) current_atcdialog->remove_entry(ident, USER_REPORT_GOING_AROUND, TOWER); string trns = t->plane.callsign; if(separateGround) { trns += " Contact ground on "; @@ -701,6 +701,8 @@ void FGTower::ProcessRunwayVacatedReport(TowerPlaneRec* t) { if(_display) { globals->get_ATC_display()->RegisterSingleMessage(trns); } + RemoveFromRwyList(t->plane.callsign); + AddToVacatedList(t); // Maybe we should check that the plane really *has* vacated the runway! } @@ -1112,7 +1114,7 @@ void FGTower::CheckRunwayList(double dt) { //cout << "Size of rwylist was " << rwyList.size() << '\n'; //cout << "Size of vacatedList was " << vacatedList.size() << '\n'; RemoveFromRwyList(t->plane.callsign); - vacatedList.push_back(t); + AddToVacatedList(t); //cout << "Size of rwylist is " << rwyList.size() << '\n'; //cout << "Size of vacatedList is " << vacatedList.size() << '\n'; // At the moment we wait until Runway Vacated is reported by the plane before telling to contact ground etc. @@ -1603,6 +1605,19 @@ bool FGTower::AddToCircuitList(TowerPlaneRec* t) { return(conflict); } +// Add to vacated list only if not already present +void FGTower::AddToVacatedList(TowerPlaneRec* t) { + tower_plane_rec_list_iterator twrItr; + bool found = false; + for(twrItr = vacatedList.begin(); twrItr != vacatedList.end(); twrItr++) { + if((*twrItr)->plane.callsign == t->plane.callsign) { + found = true; + } + } + if(found) return; + vacatedList.push_back(t); +} + // Calculate the eta of a plane to the threshold. // For ground traffic this is the fastest they can get there. diff --git a/src/ATC/tower.hxx b/src/ATC/tower.hxx index bed892b3f..aaaf5387b 100644 --- a/src/ATC/tower.hxx +++ b/src/ATC/tower.hxx @@ -318,6 +318,9 @@ private: bool AddToTrafficList(TowerPlaneRec* t, bool holding = false); bool AddToCircuitList(TowerPlaneRec* t); + + // Add to vacated list only if not already present + void AddToVacatedList(TowerPlaneRec* t); // Ground can be separate or handled by tower in real life. // In the program we will always use a separate FGGround class, but we need to know -- 2.39.5