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:
parent
9f3f1a8f58
commit
d75f05d4c0
1 changed files with 8 additions and 4 deletions
|
@ -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) {
|
||||||
auto userAIFP = userAircraft->GetFlightPlan();
|
if (userAircraft->GetFlightPlan()) {
|
||||||
userAIFP->setGate({}); // clear any assignment
|
auto userAIFP = userAircraft->GetFlightPlan();
|
||||||
|
userAIFP->setGate({}); // clear any assignment
|
||||||
|
}
|
||||||
|
|
||||||
|
userAircraft->clearATCController();
|
||||||
}
|
}
|
||||||
|
|
||||||
postinit(); // critical for position-init logic
|
postinit(); // critical for position-init logic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue