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,20 +79,23 @@ 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);
fmgc.windController.updatePlans(); fmgc.windController.updatePlans();
if (fmgc.FMGCInternal.blockConfirmed) { if (fmgc.FMGCInternal.blockConfirmed) {
fmgc.FMGCInternal.fuelCalculating = 0; fmgc.FMGCInternal.fuelCalculating = 0;
fmgc.fuelCalculating.setValue(0); fmgc.fuelCalculating.setValue(0);
fmgc.FMGCInternal.fuelCalculating = 1; fmgc.FMGCInternal.fuelCalculating = 1;
fmgc.fuelCalculating.setValue(1); fmgc.fuelCalculating.setValue(1);
}
mcdu_scratchpad.scratchpads[i].empty();
fmgc.updateARPT();
} else {
mcdu_message(i, "NOT IN DATA BASE");
} }
mcdu_scratchpad.scratchpads[i].empty();
fmgc.updateARPT();
#fmgc.FMGCInternal.altSelected = 1; #fmgc.FMGCInternal.altSelected = 1;
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
@ -249,25 +252,26 @@ 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]; atsu.ATISInstances[0].newStation(fromto[0]);
atsu.ATISInstances[0].newStation(fromto[0]); atsu.ATISInstances[1].newStation(fromto[1]);
atsu.ATISInstances[1].newStation(fromto[1]); fmgc.FMGCInternal.toFromSet = 1;
fmgc.FMGCInternal.toFromSet = 1; fmgc.FMGCNodes.toFromSet.setValue(1);
fmgc.FMGCNodes.toFromSet.setValue(1); mcdu_scratchpad.scratchpads[i].empty();
mcdu_scratchpad.scratchpads[i].empty();
fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2); 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");