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:
parent
2759977ab6
commit
5f5a9d2a5e
2 changed files with 10 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue