1
0
Fork 0

Thorsten: work around crashes when re-positioning, in the ATC-DCL code.

This commit is contained in:
James Turner 2010-07-22 00:31:29 +01:00
parent da02c09ec0
commit 8dd39e773e
2 changed files with 14 additions and 7 deletions

View 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;

View 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: