1
0
Fork 0

ATC_mgr fix: clear user aircraft ATC on reposition

Avoids a stale controller causing crashes after a reposition. Triggered
by C172 tutorials.
This commit is contained in:
Automatic Release Builder 2020-10-27 19:22:09 +00:00 committed by James Turner
parent 9f3f1a8f58
commit d75f05d4c0

View file

@ -256,11 +256,15 @@ void FGATCManager::reposition()
// available again. postinit() will recompute a new value if required // available again. postinit() will recompute a new value if required
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>(); FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
auto userAircraft = aiManager->getUserAircraft(); auto userAircraft = aiManager->getUserAircraft();
if (userAircraft && userAircraft->GetFlightPlan()) { if (userAircraft) {
if (userAircraft->GetFlightPlan()) {
auto userAIFP = userAircraft->GetFlightPlan(); auto userAIFP = userAircraft->GetFlightPlan();
userAIFP->setGate({}); // clear any assignment userAIFP->setGate({}); // clear any assignment
} }
userAircraft->clearATCController();
}
postinit(); // critical for position-init logic postinit(); // critical for position-init logic
} }