1
0
Fork 0

Fix for issue: 520: Error in FGTrafficRecord::setPositionAndIntentions.

This commit is contained in:
Durk Talsma 2011-12-30 15:27:21 +01:00
parent 229d9273d7
commit b648b71671

View file

@ -48,6 +48,7 @@
#include <Airports/dynamics.hxx> #include <Airports/dynamics.hxx>
#include <Airports/simple.hxx> #include <Airports/simple.hxx>
#include <Radio/radio.hxx> #include <Radio/radio.hxx>
#include <signal.h>
using std::sort; using std::sort;
@ -186,16 +187,11 @@ void FGTrafficRecord::setPositionAndIntentions(int pos,
if (intentions.size()) { if (intentions.size()) {
intVecIterator i = intentions.begin(); intVecIterator i = intentions.begin();
if ((*i) != pos) { if ((*i) != pos) {
SG_LOG(SG_ATC, SG_ALERT, SG_LOG(SG_ATC, SG_INFO,
"Error in FGTrafficRecord::setPositionAndIntentions at " << SG_ORIGIN); "Skipping repeated intention in FGTrafficRecord::setPositionAndIntentions at " << SG_ORIGIN);
cerr << "Pos : " << pos << " Curr " << *(intentions.begin()) << endl; } else {
for (intVecIterator i = intentions.begin(); intentions.erase(i);
i != intentions.end(); i++) {
cerr << (*i) << " ";
}
cerr << endl;
} }
intentions.erase(i);
} else { } else {
//FGAIFlightPlan::waypoint* const wpt= route->getCurrentWaypoint(); //FGAIFlightPlan::waypoint* const wpt= route->getCurrentWaypoint();
int size = route->getNrOfWayPoints(); int size = route->getNrOfWayPoints();
@ -204,18 +200,12 @@ void FGTrafficRecord::setPositionAndIntentions(int pos,
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int val = route->getRouteIndex(i); int val = route->getRouteIndex(i);
//cerr << val<< " "; //cerr << val<< " ";
if ((val) && (val != pos)) { if ((val) && (val != pos)) { // NOTE THAAT THERES A PROBLEM WITH REPEATED INTENSIONS HERE.
intentions.push_back(val); intentions.push_back(val);
//cerr << "[set] "; //cerr << "[set] ";
} }
} }
//cerr << endl;
//while (route->next(&legNr, &routeNr)) {
//intentions.push_back(routeNr);
//}
//route->rewind(currentPos);
} }
//exit(1);
} }
/** /**
* Check if another aircraft is ahead of the current one, and on the same * Check if another aircraft is ahead of the current one, and on the same