1
0
Fork 0

Removed a potentially illegal cross-container iterator comparison that made

FlightGear crash on mircosoft visual c++ compilers, as reported by Maik
Justus.
This commit is contained in:
durk 2006-11-25 07:52:08 +00:00
parent 6ad85fbae9
commit 3bd32f75e4
2 changed files with 20 additions and 22 deletions

View file

@ -765,7 +765,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
SG_LOG(SG_GENERAL, SG_ALERT, "AI error: Trying to access non-existing aircraft in FGGroundNetwork::checkSpeedAdjustment"); SG_LOG(SG_GENERAL, SG_ALERT, "AI error: Trying to access non-existing aircraft in FGGroundNetwork::checkSpeedAdjustment");
} }
current = i; current = i;
closest = current; //closest = current;
previousInstruction = current->getSpeedAdjustment(); previousInstruction = current->getSpeedAdjustment();
double mindist = HUGE; double mindist = HUGE;
if (activeTraffic.size()) if (activeTraffic.size())
@ -775,7 +775,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
lat, lat,
alt); alt);
//TrafficVector iterator closest; //TrafficVector iterator closest;
//closest = current; closest = current;
for (TrafficVectorIterator i = activeTraffic.begin(); for (TrafficVectorIterator i = activeTraffic.begin();
i != activeTraffic.end(); i++) i != activeTraffic.end(); i++)
{ {
@ -804,25 +804,24 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
for (TrafficVectorIterator i = towerController->getActiveTraffic().begin(); for (TrafficVectorIterator i = towerController->getActiveTraffic().begin();
i != towerController->getActiveTraffic().end(); i++) i != towerController->getActiveTraffic().end(); i++)
{ {
if (i != current) { //cerr << "Comparing " << current->getId() << " and " << i->getId() << endl;
//SGWayPoint curr (lon, //SGWayPoint curr (lon,
// lat, // lat,
// alt); // alt);
SGWayPoint other (i->getLongitude (), SGWayPoint other (i->getLongitude (),
i->getLatitude (), i->getLatitude (),
i->getAltitude ()); i->getAltitude ());
other.CourseAndDistance(curr, &course, &dist); other.CourseAndDistance(curr, &course, &dist);
bearing = fabs(heading-course); bearing = fabs(heading-course);
if (bearing > 180) if (bearing > 180)
bearing = 360-bearing; bearing = 360-bearing;
if ((dist < mindist) && (bearing < 60.0)) if ((dist < mindist) && (bearing < 60.0))
{ {
mindist = dist; mindist = dist;
closest = i; closest = i;
minbearing = bearing; minbearing = bearing;
otherReasonToSlowDown = true; otherReasonToSlowDown = true;
} }
}
} }
} }
// Finally, check UserPosition // Finally, check UserPosition

View file

@ -173,7 +173,6 @@ public:
string getRunway() { return runway; }; string getRunway() { return runway; };
void setCallSign(string clsgn) { callsign = clsgn; }; void setCallSign(string clsgn) { callsign = clsgn; };
string getCallSign() { return callsign; }; string getCallSign() { return callsign; };
}; };
typedef vector<FGTrafficRecord> TrafficVector; typedef vector<FGTrafficRecord> TrafficVector;