]> git.mxchange.org Git - flightgear.git/commitdiff
Slightly more robust handling of runway vacation
authordaveluff <daveluff>
Sat, 20 Mar 2004 02:55:25 +0000 (02:55 +0000)
committerdaveluff <daveluff>
Sat, 20 Mar 2004 02:55:25 +0000 (02:55 +0000)
src/ATC/tower.cxx
src/ATC/tower.hxx

index a9e2ba709b6367d8dcd3c4dc9b112939274b4a31..dff977f6f95586f9138fd7e6eaca4bf1f00eb9ab 100644 (file)
@@ -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.
index bed892b3f2f54d790ca7eb2c44ae50e25c9d996f..aaaf5387b8ace7e2c6454a15d1cfbb4ed429b28a 100644 (file)
@@ -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