-Prevent crashing the sim when starting at a gate that is not connected to the ground network. For now, just silently shut down the ATC system.
This commit is contained in:
parent
b175d8f1ac
commit
1e4b17595a
3 changed files with 150 additions and 141 deletions
|
@ -148,9 +148,12 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
|
||||||
FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(gateId);
|
FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(gateId);
|
||||||
FGTaxiSegmentVectorIterator ts = tn->getBeginRoute();
|
FGTaxiSegmentVectorIterator ts = tn->getBeginRoute();
|
||||||
FGTaxiSegmentVectorIterator te = tn->getEndRoute();
|
FGTaxiSegmentVectorIterator te = tn->getEndRoute();
|
||||||
|
// if the starting node equals the ending node, then there aren't any routes for this parking.
|
||||||
|
// in cases like these we should flag the gate as being inoperative and return false
|
||||||
if (ts == te) {
|
if (ts == te) {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Gate " << gateId << "doesn't seem to have routes associated with it.");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Gate " << gateId << "doesn't seem to have routes associated with it.");
|
||||||
//exit(1);
|
parking->setAvailable(false);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
tn = (*ts)->getEnd();
|
tn = (*ts)->getEnd();
|
||||||
lastNodeVisited = tn->getIndex();
|
lastNodeVisited = tn->getIndex();
|
||||||
|
|
|
@ -37,6 +37,7 @@ FGATCManager::FGATCManager() {
|
||||||
controller = 0;
|
controller = 0;
|
||||||
prevController = 0;
|
prevController = 0;
|
||||||
networkVisible = false;
|
networkVisible = false;
|
||||||
|
initSucceeded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGATCManager::~FGATCManager() {
|
FGATCManager::~FGATCManager() {
|
||||||
|
@ -136,7 +137,7 @@ void FGATCManager::init() {
|
||||||
string aircraftType; // Unused.
|
string aircraftType; // Unused.
|
||||||
string airline; // Currently used for gate selection, but a fallback mechanism will apply when not specified.
|
string airline; // Currently used for gate selection, but a fallback mechanism will apply when not specified.
|
||||||
fp->setGate(park_index);
|
fp->setGate(park_index);
|
||||||
fp->createPushBack(&ai_ac,
|
if (!(fp->createPushBack(&ai_ac,
|
||||||
false,
|
false,
|
||||||
apt,
|
apt,
|
||||||
latitude,
|
latitude,
|
||||||
|
@ -144,7 +145,10 @@ void FGATCManager::init() {
|
||||||
aircraftRadius,
|
aircraftRadius,
|
||||||
fltType,
|
fltType,
|
||||||
aircraftType,
|
aircraftType,
|
||||||
airline);
|
airline))) {
|
||||||
|
controller = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
fp->getLastWaypoint()->setName( fp->getLastWaypoint()->getName() + string("legend"));
|
fp->getLastWaypoint()->setName( fp->getLastWaypoint()->getName() + string("legend"));
|
||||||
|
@ -170,6 +174,7 @@ void FGATCManager::init() {
|
||||||
//cerr << "Adding groundnetWork to the scenegraph::init" << endl;
|
//cerr << "Adding groundnetWork to the scenegraph::init" << endl;
|
||||||
//globals->get_scenery()->get_scene_graph()->addChild(node);
|
//globals->get_scenery()->get_scene_graph()->addChild(node);
|
||||||
}
|
}
|
||||||
|
initSucceeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGATCManager::addController(FGATCController *controller) {
|
void FGATCManager::addController(FGATCController *controller) {
|
||||||
|
|
|
@ -52,6 +52,7 @@ private:
|
||||||
FGATCController *controller, *prevController; // The ATC controller that is responsible for the user's aircraft.
|
FGATCController *controller, *prevController; // The ATC controller that is responsible for the user's aircraft.
|
||||||
//FGATCDialogNew dialog; // note that this variable should really replace the ugly global "currentATCDialog();
|
//FGATCDialogNew dialog; // note that this variable should really replace the ugly global "currentATCDialog();
|
||||||
bool networkVisible;
|
bool networkVisible;
|
||||||
|
bool initSucceeded;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGATCManager();
|
FGATCManager();
|
||||||
|
|
Loading…
Add table
Reference in a new issue