1
0
Fork 0

Make AI traffic more robust to not getting a list of runway exits - it is now simply removed from view at the end of the landing roll instead of stackdumping if no exits are returned

This commit is contained in:
daveluff 2002-12-19 12:26:10 +00:00
parent 2d09acb10f
commit 5931760602

View file

@ -100,7 +100,8 @@ void FGAILocalTraffic::Init() {
// Commands to do something from higher level logic // Commands to do something from higher level logic
void FGAILocalTraffic::FlyCircuits(int numCircuits, bool tag) { void FGAILocalTraffic::FlyCircuits(int numCircuits, bool tag) {
circuitsToFly += numCircuits; circuitsToFly += numCircuits - 1; // Hack (-1) because we only test and decrement circuitsToFly after landing
// thus flying one to many circuits. TODO - Need to sort this out better!
touchAndGo = tag; touchAndGo = tag;
//At the moment we'll assume that we are always finished previous circuits when called, //At the moment we'll assume that we are always finished previous circuits when called,
@ -495,6 +496,7 @@ void FGAILocalTraffic::ExitRunway(Point3D orthopos) {
node_array_type exitNodes = airport.GetExits(rwy.ID); //I suppose we ought to have some fallback for rwy with no defined exits? node_array_type exitNodes = airport.GetExits(rwy.ID); //I suppose we ought to have some fallback for rwy with no defined exits?
//cout << "Got exits" << endl; //cout << "Got exits" << endl;
//cout << "Size of exits array is " << exitNodes.size() << endl; //cout << "Size of exits array is " << exitNodes.size() << endl;
if(exitNodes.size()) {
//Find the next exit from orthopos.y //Find the next exit from orthopos.y
double d; double d;
double dist = 100000; //ie. longer than any runway in existance double dist = 100000; //ie. longer than any runway in existance
@ -528,6 +530,13 @@ void FGAILocalTraffic::ExitRunway(Point3D orthopos) {
//cout << "Size of path is " << path.size() << endl; //cout << "Size of path is " << path.size() << endl;
taxiState = TD_INBOUND; taxiState = TD_INBOUND;
StartTaxi(); StartTaxi();
} else {
// Something must have gone wrong with the ground network file - or there is only a rwy here and no exits defined
SG_LOG(SG_GENERAL, SG_ALERT, "No exits found by FGAILocalTraffic from runway " << rwy.ID << " at " << airportID << '\n');
// What shall we do - just remove the plane from sight?
aip.setVisible(false);
operatingState = PARKED;
}
} }
// Set the class variable nextTaxiNode to the next node in the path // Set the class variable nextTaxiNode to the next node in the path
@ -538,7 +547,7 @@ void FGAILocalTraffic::GetNextTaxiNode() {
//cout << "taxiPathPos = " << taxiPathPos << endl; //cout << "taxiPathPos = " << taxiPathPos << endl;
ground_network_path_iterator pathItr = path.begin() + taxiPathPos; ground_network_path_iterator pathItr = path.begin() + taxiPathPos;
if(pathItr == path.end()) { if(pathItr == path.end()) {
//cout << "ERROR IN AILocalTraffic::GetNextTaxiNode - no more nodes in path" << endl; SG_LOG(SG_GENERAL, SG_ALERT, "ERROR IN AILocalTraffic::GetNextTaxiNode - no more nodes in path\n");
} else { } else {
if((*pathItr)->struct_type == NODE) { if((*pathItr)->struct_type == NODE) {
//cout << "ITS A NODE" << endl; //cout << "ITS A NODE" << endl;
@ -553,13 +562,13 @@ void FGAILocalTraffic::GetNextTaxiNode() {
pathItr++; pathItr++;
taxiPathPos++; taxiPathPos++;
if(pathItr == path.end()) { if(pathItr == path.end()) {
//cout << "ERROR IN AILocalTraffic::GetNextTaxiNode - path ended with an arc" << endl; SG_LOG(SG_GENERAL, SG_ALERT, "ERROR IN AILocalTraffic::GetNextTaxiNode - path ended with an arc\n");
} else if((*pathItr)->struct_type == NODE) { } else if((*pathItr)->struct_type == NODE) {
nextTaxiNode = (node*)*pathItr; nextTaxiNode = (node*)*pathItr;
++taxiPathPos; ++taxiPathPos;
} else { } else {
//OOPS - two non-nodes in a row - that shouldn't happen ATM //OOPS - two non-nodes in a row - that shouldn't happen ATM
//cout << "ERROR IN AILocalTraffic::GetNextTaxiNode - two non-nodes in sequence" << endl; SG_LOG(SG_GENERAL, SG_ALERT, "ERROR IN AILocalTraffic::GetNextTaxiNode - two non-nodes in sequence\n");
} }
} }
} }