1
0
Fork 0

findAirportsByICAO

This commit is contained in:
Jonathan Redpath 2022-02-15 23:37:44 +00:00
parent 7fe513d974
commit 45fd29792c

View file

@ -79,8 +79,8 @@ var initInputA = func(key, i) {
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else if (fmgc.FMGCInternal.toFromSet) { } else if (fmgc.FMGCInternal.toFromSet) {
if (!fmgc.flightPlanController.temporaryFlag[i]) { if (!fmgc.flightPlanController.temporaryFlag[i]) {
var tfs = size(scratchpad); if (size(scratchpad) == 4) {
if (tfs == 4) { if (size(findAirportsByICAO(scratchpad)) > 0) {
fmgc.FMGCInternal.altAirport = scratchpad; fmgc.FMGCInternal.altAirport = scratchpad;
fmgc.FMGCInternal.altAirportSet = 1; fmgc.FMGCInternal.altAirportSet = 1;
atsu.ATISInstances[2].newStation(scratchpad); atsu.ATISInstances[2].newStation(scratchpad);
@ -93,6 +93,9 @@ var initInputA = func(key, i) {
} }
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
fmgc.updateARPT(); fmgc.updateARPT();
} else {
mcdu_message(i, "NOT IN DATA BASE");
}
#fmgc.FMGCInternal.altSelected = 1; #fmgc.FMGCInternal.altSelected = 1;
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
@ -249,12 +252,10 @@ var initInputA = func(key, i) {
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
if (!fmgc.flightPlanController.temporaryFlag[i]) { if (!fmgc.flightPlanController.temporaryFlag[i]) {
var tfs = size(scratchpad); if (size(scratchpad) == 9 and find("/", scratchpad) != -1) {
if (tfs == 9 and find("/", scratchpad) != -1) {
var fromto = split("/", scratchpad); var fromto = split("/", scratchpad);
var froms = size(fromto[0]); if (size(fromto[0]) == 4 and size(fromto[1]) == 4) {
var tos = size(fromto[1]); if (size(findAirportsByICAO(fromto[0])) > 0 and size(findAirportsByICAO(fromto[1])) > 0) {
if (froms == 4 and tos == 4) {
resetFlightplan(i); resetFlightplan(i);
fmgc.FMGCInternal.depApt = fromto[0]; fmgc.FMGCInternal.depApt = fromto[0];
fmgc.FMGCInternal.arrApt = fromto[1]; fmgc.FMGCInternal.arrApt = fromto[1];
@ -268,6 +269,9 @@ var initInputA = func(key, i) {
fmgc.FMGCInternal.altSelected = 0; fmgc.FMGCInternal.altSelected = 0;
fmgc.updateARPT(); fmgc.updateARPT();
fmgc.updateArptLatLon(); fmgc.updateArptLatLon();
} else {
mcdu_message(i, "NOT IN DATA BASE");
}
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");