1
0
Fork 0

GroundController: remove always false condition

This commit is contained in:
Scott Giese 2021-12-26 20:16:41 -06:00
parent 3e096fed41
commit e38fb0c440

View file

@ -608,7 +608,8 @@ bool FGGroundController::checkForCircularWaits(int id)
} else {
return false;
}
if (i == activeTraffic.end() || (trafficSize == 0)) {
if (i == activeTraffic.end()) {
SG_LOG(SG_GENERAL, SG_ALERT,
"AI error: Trying to access non-existing aircraft in FGGroundNetwork::checkForCircularWaits at " << SG_ORIGIN);
}
@ -623,12 +624,10 @@ bool FGGroundController::checkForCircularWaits(int id)
return false;
}
while ((target > 0) && (target != id) && counter++ < trafficSize) {
//printed = true;
TrafficVectorIterator i = activeTraffic.begin();
if (trafficSize) {
//while ((i->getId() != id) && i != activeTraffic.end())
while (i != activeTraffic.end()) {
if (i->getId() == target) {
break;
@ -638,41 +637,24 @@ bool FGGroundController::checkForCircularWaits(int id)
} else {
return false;
}
if (i == activeTraffic.end() || (trafficSize == 0)) {
if (i == activeTraffic.end()) {
SG_LOG(SG_ATC, SG_DEBUG, "[Waiting for traffic at Runway: DONE] ");
// The target id is not found on the current network, which means it's at the tower
SG_LOG(SG_ATC, SG_ALERT, "AI error: Trying to access non-existing aircraft in FGGroundNetwork::checkForCircularWaits");
return false;
}
other = i;
target = other->getWaitsForId();
// actually this trap isn't as impossible as it first seemed:
// the setWaitsForID(id) is set to current when the aircraft
// is waiting for the user controlled aircraft.
//if (current->getId() == other->getId()) {
// SG_LOG(SG_ATC, SG_DEBUG, "Caught the impossible trap");
// SG_LOG(SG_ATC, SG_DEBUG, "Current = " << current->getId());
// SG_LOG(SG_ATC, SG_DEBUG, "Other = " << other ->getId());
// for (TrafficVectorIterator at = activeTraffic.begin();
// at != activeTraffic.end();
// at++) {
// SG_LOG(SG_ATC, SG_BULK, "currently active aircraft : " << at->getCallSign() << " with Id " << at->getId() << " waits for " << at->getWaitsForId());
// }
// exit(1);
if (current->getId() == other->getId())
return false;
//}
//SG_LOG(SG_ATC, SG_DEBUG, current->getCallSign() << " (" << current->getId() << ") " << " -> " << other->getCallSign()
// << " (" << other->getId() << "); ");
//current = other;
}
//if (printed)
SG_LOG(SG_ATC, SG_DEBUG, "[done] ");
if (id == target) {