1
0
Fork 0

Fix RNAVProcedureTests::testIndexOf

Make FlightPlan::findIndexOfWp use the correct ::matches() method,
and special case this for basic waypoints. This fixes the behaviour
when loaded routes / procedures store a navaid-waypoint as basic.
This commit is contained in:
James Turner 2020-05-19 22:24:07 +01:00
parent 2759977ab6
commit 5f5a9d2a5e
2 changed files with 10 additions and 2 deletions

View file

@ -378,7 +378,7 @@ int FlightPlan::findWayptIndex(const SGGeod& aPos) const
int FlightPlan::findWayptIndex(const FGPositionedRef aPos) const
{
for (int i=0; i<numLegs(); ++i) {
if (_legs[i]->waypoint()->source() == aPos) {
if (_legs[i]->waypoint()->matches(aPos)) {
return i;
}
}

View file

@ -101,7 +101,15 @@ bool Waypt::matches(Waypt* aOther) const
bool Waypt::matches(FGPositioned* aPos) const
{
return aPos && (aPos == source());
if (!aPos)
return false;
// if w ehave no source, match on position and ident
if (!source()) {
return (ident() == aPos->ident()) && matches(aPos->geod());
}
return (aPos == source());
}
bool Waypt::matches(const SGGeod& aPos) const