1
0
Fork 0

-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:
Durk Talsma 2011-09-11 21:42:29 +02:00
parent b175d8f1ac
commit 1e4b17595a
3 changed files with 150 additions and 141 deletions

View file

@ -148,9 +148,12 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(gateId);
FGTaxiSegmentVectorIterator ts = tn->getBeginRoute();
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) {
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();
lastNodeVisited = tn->getIndex();

View file

@ -37,6 +37,7 @@ FGATCManager::FGATCManager() {
controller = 0;
prevController = 0;
networkVisible = false;
initSucceeded = false;
}
FGATCManager::~FGATCManager() {
@ -136,7 +137,7 @@ void FGATCManager::init() {
string aircraftType; // Unused.
string airline; // Currently used for gate selection, but a fallback mechanism will apply when not specified.
fp->setGate(park_index);
fp->createPushBack(&ai_ac,
if (!(fp->createPushBack(&ai_ac,
false,
apt,
latitude,
@ -144,7 +145,10 @@ void FGATCManager::init() {
aircraftRadius,
fltType,
aircraftType,
airline);
airline))) {
controller = 0;
return;
}
}
fp->getLastWaypoint()->setName( fp->getLastWaypoint()->getName() + string("legend"));
@ -170,6 +174,7 @@ void FGATCManager::init() {
//cerr << "Adding groundnetWork to the scenegraph::init" << endl;
//globals->get_scenery()->get_scene_graph()->addChild(node);
}
initSucceeded = true;
}
void FGATCManager::addController(FGATCController *controller) {

View file

@ -52,6 +52,7 @@ private:
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();
bool networkVisible;
bool initSucceeded;
public:
FGATCManager();