Skip last fix if it is the destination airport

This commit is contained in:
Tobias Dammers 2022-05-03 08:03:30 +02:00
parent d807570a43
commit c489277b32

View File

@ -99,7 +99,8 @@ var toFlightplan = func (ofp, fp=nil) {
var ofpFixes = ofpNavlog.getChildren('fix');
var sidID = nil;
var starID = nil;
foreach (var ofpFix; ofpFixes) {
forindex (var fixIndex; ofpFixes) {
var ofpFix = ofpFixes[fixIndex];
if (ofpFix.getNode('is_sid_star').getValue() == 1) {
if ((ofpFix.getValue('stage') == 'CLB') and
(getprop('/sim/simbrief/options/import-departure') or 0) and
@ -122,6 +123,13 @@ var toFlightplan = func (ofp, fp=nil) {
}
continue;
}
# if no STAR was filed, simbrief may include the destination airport
# as a fix, which will break the flightplan if we later attempt to
# select a STAR, transition, or approach ourselves, so we need to skip
# it.
if (ident == destinationID and fixIndex == (size(ofpFixes) - 1)) {
continue;
}
var altNode = ofpFix.getNode('altitude_feet');
var alt = (altNode == nil) ? nil : altNode.getValue();
var coords = geo.Coord.new();