1
0
Fork 0

ALTN: case airport is missing

This commit is contained in:
Jonathan Redpath 2022-01-27 18:39:59 +00:00
parent 05d36c1c89
commit 5d857ec338

View file

@ -449,20 +449,24 @@ var fplnPage = { # this one is only created once, and then updated - remember th
if (!fmgc.FMGCInternal.altAirportSet) {
append(me.planList, staticText.new(me.computer, me.getText("noAltnFpln")));
} else {
var altnApt = findAirportsByICAO(fmgc.FMGCInternal.altAirport)[0];
append(me.planList, fplnItem.new({
alt_cstr: nil,
alt_cstr_type: nil,
fly_type: "flyBy",
lat: altnApt.lat,
leg_bearing: courseAndDistance(findAirportsByICAO(fmgc.FMGCInternal.arrApt)[0], altnApt)[0],
leg_distance: courseAndDistance(findAirportsByICAO(fmgc.FMGCInternal.arrApt)[0], altnApt)[1],
lon: altnApt.lon,
speed_cstr: nil,
speed_cstr_type: nil,
wp_name: fmgc.FMGCInternal.altAirport,
}, i, me.planIndex, me.computer, "blu"));
append(me.planList, staticText.new(me.computer, me.getText("altnFplnEnd")));
var altnApt = findAirportsByICAO(fmgc.FMGCInternal.altAirport);
if (size(altnApt) > 0) {
append(me.planList, fplnItem.new({
alt_cstr: nil,
alt_cstr_type: nil,
fly_type: "flyBy",
lat: altnApt.lat,
leg_bearing: courseAndDistance(findAirportsByICAO(fmgc.FMGCInternal.arrApt)[0], altnApt[0])[0],
leg_distance: courseAndDistance(findAirportsByICAO(fmgc.FMGCInternal.arrApt)[0], altnApt[0])[1],
lon: altnApt.lon,
speed_cstr: nil,
speed_cstr_type: nil,
wp_name: fmgc.FMGCInternal.altAirport,
}, i, me.planIndex, me.computer, "blu"));
append(me.planList, staticText.new(me.computer, me.getText("altnFplnEnd")));
} else {
append(me.planList, staticText.new(me.computer, me.getText("noAltnFpln")));
}
}
me.basePage();