Skip to content

Commit

Permalink
Fixed issue with airway missing
Browse files Browse the repository at this point in the history
This affected plans that have only one leg between departure and arrival.
As a result airway was dropped on saving, exporting and route description.
Example: `SBRJ EVKO3A.NAXOP UZ45 IBDA1A SBSP` resulted in `SBRJ EVKO3A.NAXOP IBDA1A SBSP`
#1130
  • Loading branch information
albar965 committed Aug 8, 2024
1 parent 285cb83 commit fbe9799
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/route/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2510,9 +2510,11 @@ bool Route::arrivalRouteToProcLegs(int& arrivaLegsOffset) const
arrivaLegsOffset = getArrivaLegsOffset();
if(arrivaLegsOffset > 0 && arrivaLegsOffset < size() - 1)
{
const RouteLeg& routeLeg = value(arrivaLegsOffset - 1);
const RouteLeg& arrivalLeg = value(arrivaLegsOffset);
return arrivalLeg.isAnyProcedure() && arrivalLeg.isValid() && routeLeg.isValid() && routeLeg.isRoute();
const RouteLeg& prevRouteLeg = value(arrivaLegsOffset - 1);
const RouteLeg& nextArrivalLeg = value(arrivaLegsOffset);
return nextArrivalLeg.isAnyProcedure() && nextArrivalLeg.isValid() && prevRouteLeg.isValid() &&
// Previous leg is en-route or a departure
(prevRouteLeg.isRoute() || prevRouteLeg.getProcedureLeg().isAnyDeparture());
}
}
return false;
Expand All @@ -2526,9 +2528,10 @@ bool Route::departureProcToRouteLegs(int& startIndexAfterProcedure) const
startIndexAfterProcedure = getStartIndexAfterProcedure();
if(startIndexAfterProcedure > 0 && startIndexAfterProcedure < size() - 1)
{
const RouteLeg& departureLeg = value(startIndexAfterProcedure - 1);
const RouteLeg& routeLeg = value(startIndexAfterProcedure);
return departureLeg.isAnyProcedure() && departureLeg.isValid() && routeLeg.isRoute() && routeLeg.isValid();
const RouteLeg& prevDepartureLeg = value(startIndexAfterProcedure - 1);
const RouteLeg& nextRouteLeg = value(startIndexAfterProcedure);
return prevDepartureLeg.isAnyProcedure() && prevDepartureLeg.isValid() && nextRouteLeg.isValid() &&
(nextRouteLeg.isRoute() || nextRouteLeg.getProcedureLeg().isAnyArrival());
}
}
return false;
Expand Down

0 comments on commit fbe9799

Please sign in to comment.