]> git.mxchange.org Git - flightgear.git/commitdiff
Thorsten: work around crashes when re-positioning, in the ATC-DCL code.
authorJames Turner <zakalawe@mac.com>
Wed, 21 Jul 2010 23:31:29 +0000 (00:31 +0100)
committerJames Turner <zakalawe@mac.com>
Wed, 21 Jul 2010 23:31:29 +0000 (00:31 +0100)
src/ATCDCL/AILocalTraffic.cxx
src/ATCDCL/ATCmgr.cxx

index 8a66eda6e0a976cc67e1ac5c96c86599bc9b887c..4c3e67c5782233f4bd7835ce06255a03474edd15 100644 (file)
@@ -108,6 +108,12 @@ FGAILocalTraffic::FGAILocalTraffic() {
        _controlled = false;
        
        _invisible = false;
+
+        ground = NULL;
+        tower = NULL;
+        ourGate = NULL;
+        nextTaxiNode = NULL;
+        holdShortNode = NULL;
 }
 
 FGAILocalTraffic::~FGAILocalTraffic() {
@@ -1254,13 +1260,13 @@ void FGAILocalTraffic::ProcessCallback(int code) {
        if(code == 1) {
                ground->RequestDeparture(plane, this);
        } else if(code == 2) {
-               tower->ContactAtHoldShort(plane, this, CIRCUIT);
+               if (_controlled) tower->ContactAtHoldShort(plane, this, CIRCUIT);
        } else if(code == 3) {
-               tower->ReportRunwayVacated(plane.callsign);
+                if (_controlled) tower->ReportRunwayVacated(plane.callsign);
        } else if(code == 11) {
-               tower->ReportDownwind(plane.callsign);
+                if (_controlled) tower->ReportDownwind(plane.callsign);
        } else if(code == 13) {
-               tower->ReportFinal(plane.callsign);
+                if (_controlled) tower->ReportFinal(plane.callsign);
        } else if(code == 99) { // Flag this instance for deletion
                responseCounter = 0;
                _removeSelf = true;
index 19053adef5f712342dfc2fd0ce18fdaa15ed441d..2cb352a4f7b5f6c05323340fe9b62bbc35d7c2d4 100644 (file)
@@ -273,8 +273,7 @@ typedef map<string,int> MSI;
 
 void FGATCMgr::ZapOtherService(const string ncunit, const string svc_name){
   for (atc_list_iterator svc = atc_list->begin(); svc != atc_list->end(); svc++) {
-    //cout << "Zapping " << navcomm 
-    //  << "[" << unit << "]"  << "  otherthan: " << svc_name << endl;
+   
     if (svc->first != svc_name) {
       MSI &actv = svc->second->active_on;
       // OK, we have found some OTHER service;
@@ -286,7 +285,9 @@ void FGATCMgr::ZapOtherService(const string ncunit, const string svc_name){
         //cout << "Eradicating service: '" << svc->first << "'" << endl;
     svc->second->SetNoDisplay();
     svc->second->Update(0);     // one last update
-    delete svc->second;
+    SG_LOG(SG_GENERAL, SG_INFO, "would have erased ATC service:" << svc->second->get_name()<< "/" 
+      << svc->second->get_ident());
+   // delete svc->second;
     atc_list->erase(svc);
 // ALL pointers into the ATC list are now invalid,
 // so let's reset them: