From 630dc3b179ae0e0405046310021058a84c703f6e Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 10 Jul 2020 20:28:17 +0100 Subject: [PATCH] Rest of INITA converted --- Models/Instruments/MCDU/MCDU.nas | 39 ++++++++++++++++---------------- Nasal/FMGC/FMGC.nas | 13 ++++++----- Nasal/FMGC/flightplan.nas | 22 +++++++----------- Nasal/FMGC/winds.nas | 8 +++---- Nasal/MCDU/FUELPRED.nas | 2 +- Nasal/MCDU/INITA.nas | 20 ++++++++-------- Nasal/MCDU/INITB.nas | 2 +- Nasal/MCDU/IRSINIT.nas | 8 +++---- Nasal/MCDU/MCDU.nas | 15 ++++++------ Nasal/MCDU/PROGCLB.nas | 2 +- Nasal/MCDU/PROGCRZ.nas | 2 +- Nasal/MCDU/PROGDES.nas | 2 +- Nasal/MCDU/PROGTO.nas | 2 +- 13 files changed, 67 insertions(+), 70 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index a638563a..392ad70e 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -103,7 +103,6 @@ var vor2CRS = props.globals.getNode("/instrumentation/nav[3]/radials/selected-de # INT-A var depArpt = props.globals.getNode("/FMGC/internal/dep-arpt", 1); var arrArpt = props.globals.getNode("/FMGC/internal/arr-arpt", 1); -var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1); var costIndex = props.globals.getNode("/FMGC/internal/cost-index", 1); var costIndexSet = props.globals.getNode("/FMGC/internal/cost-index-set", 1); var ADIRSMCDUBTN = props.globals.getNode("/controls/adirs/mcducbtn", 1); @@ -1087,7 +1086,7 @@ var canvas_MCDU_base = { me["Simple_L3"].hide(); } - if (toFromSet.getValue() != 1 and costIndexSet.getValue() != 1) { + if (!fmgc.FMGCInternal.toFromSet and costIndexSet.getValue() != 1) { me["INITA_CostIndex"].hide(); me["Simple_L5"].setColor(1,1,1); me["Simple_L5"].show(); @@ -1101,7 +1100,7 @@ var canvas_MCDU_base = { me["INITA_CostIndex"].show(); me["Simple_L5"].hide(); } - if (toFromSet.getValue() != 1 and !fmgc.FMGCInternal.crzSet) { + if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.crzSet) { me["INITA_CruiseFLTemp"].hide(); me["Simple_L6"].setColor(1,1,1); me["Simple_L6"].setText("-----/---g"); @@ -1120,12 +1119,12 @@ var canvas_MCDU_base = { me["Simple_L6"].setColor(0.7333,0.3803,0); me["Simple_L6"].setText(" g"); } - if (toFromSet.getValue() == 1) { + if (fmgc.FMGCInternal.toFromSet) { me["INITA_CoRoute"].hide(); me["INITA_FromTo"].hide(); me["Simple_L1"].show(); me["Simple_L2"].setColor(0.0901,0.6039,0.7176); - if (altSet.getValue() == 1) { + if (fmgc.FMGCInternal.altAirportSet) { me["Simple_L2"].setText(fmgc.FMGCInternal.altAirport); } else { me["Simple_L2"].setText("NONE"); @@ -1183,7 +1182,7 @@ var canvas_MCDU_base = { me["Simple_R2S"].setText("INIT "); me["Simple_R5S"].setText("TROPO"); - me["Simple_R1"].setText(sprintf("%s", depArpt.getValue() ~ "/" ~ arrArpt.getValue())); + me["Simple_R1"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt)); me["Simple_R2"].setText("REQUEST "); me["Simple_R3"].setText("IRS INIT "); me["Simple_R4"].setText("WIND "); @@ -1257,7 +1256,7 @@ var canvas_MCDU_base = { me["IRSINIT_2"].hide(); } - if (toFromSet.getValue() == 1) { + if (fmgc.FMGCInternal.toFromSet) { degrees = getprop("/FMGC/internal/align-ref-lat-degrees"); minutes = getprop("/FMGC/internal/align-ref-lat-minutes"); sign = getprop("/FMGC/internal/align-ref-lat-sign"); @@ -1412,12 +1411,12 @@ var canvas_MCDU_base = { me["Simple_L1"].setText("NONE"); me["Simple_L6"].setText(" RETURN"); - if (toFromSet.getValue() and !fmgc.FMGCInternal.altSelected) { - me["Simple_Title"].setText(sprintf("%s", depArpt.getValue() ~ "/" ~ arrArpt.getValue())); - } else if (!toFromSet.getValue() and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { + if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) { + me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt)); + } else if (!fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.altAirport)); - } else if (toFromSet.getValue() and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { - me["Simple_Title"].setText(sprintf("%s", arrArpt.getValue() ~ "/" ~ fmgc.FMGCInternal.altAirport)); + } else if (fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) { + me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.arrApt ~ "/" ~ fmgc.FMGCInternal.altAirport)); } else { me["Simple_Title"].setText("ROUTE SELECTION"); } @@ -1666,7 +1665,7 @@ var canvas_MCDU_base = { me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); } } - if (altSet.getValue() == 1) { + if (fmgc.FMGCInternal.crzSet == 1) { me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue())); me["Simple_L4"].setColor(BLUE); me["Simple_C4"].show(); @@ -1773,7 +1772,7 @@ var canvas_MCDU_base = { me["Simple_C3"].setFontSize(small); } - if (alt_fuel_set.getValue() == 1 and altSet.getValue() == 1) { + if (alt_fuel_set.getValue() == 1 and fmgc.FMGCInternal.crzSet == 1) { me["Simple_L4"].setFontSize(normal); } else { me["Simple_L4"].setFontSize(small); @@ -1857,10 +1856,10 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (!engrdy.getBoolValue() or toFromSet.getValue() != 1) { + if (!engrdy.getBoolValue() or !fmgc.FMGCInternal.toFromSet) { me["Simple_L1"].setText("----"); } else { - me["Simple_L1"].setText(arrArpt.getValue()); + me["Simple_L1"].setText(fmgc.FMGCInternal.arrApt); } if (!engrdy.getBoolValue() or !fmgc.FMGCInternal.altAirportSet) { me["Simple_L2"].setText("----"); @@ -1945,7 +1944,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); } } - if (altSet.getValue() == 1) { + if (fmgc.FMGCInternal.crzSet == 1) { me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue())); me["Simple_L4"].setColor(BLUE); me["Simple_C4"].show(); @@ -2041,7 +2040,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].setFontSize(small); } - if (alt_fuel_set.getValue() == 1 and altSet.getValue() == 1) { + if (alt_fuel_set.getValue() == 1 and fmgc.FMGCInternal.crzSet == 1) { me["Simple_L4"].setFontSize(normal); } else { me["Simple_L4"].setFontSize(small); @@ -2285,7 +2284,7 @@ var canvas_MCDU_base = { me["Simple_R5S"].setText("ENG OUT ACC"); me["Simple_R6S"].setText("NEXT "); - if (fmgc.FMGCInternal.transAltSet) { + if (fmgc.FMGCInternal.transcrzSet) { me["Simple_L4"].setFontSize(normal); } else { me["Simple_L4"].setFontSize(small); @@ -2970,7 +2969,7 @@ var canvas_MCDU_base = { me["Simple_L4S"].setText("TRANS FL"); me["Simple_L4"].setText("FL" ~ sprintf("%2.0f", (fmgc.FMGCInternal.transAlt / 100))); - if (fmgc.FMGCInternal.transAltSet) { + if (fmgc.FMGCInternal.transcrzSet) { me["Simple_L4"].setFontSize(normal); } else { me["Simple_L4"].setFontSize(small); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index bd752f95..6b1d1848 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -160,7 +160,9 @@ var FMGCInternal = { altAirport: "", altAirportSet: 0, altSelected: 0, - + arrApt: "", + depApt: "", + toFromSet: 0, }; var postInit = func() { @@ -173,6 +175,7 @@ var postInit = func() { var FMGCNodes = { v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"), v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"), + toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"), }; ############ @@ -196,10 +199,8 @@ var trimReset = func { ############### var updateARPT = func { - dep = getprop("/FMGC/internal/dep-arpt"); - arr = getprop("/FMGC/internal/arr-arpt"); - setprop("autopilot/route-manager/departure/airport", dep); - setprop("autopilot/route-manager/destination/airport", arr); + setprop("autopilot/route-manager/departure/airport", fmgc.FMGCInternal.depApt); + setprop("autopilot/route-manager/destination/airport", fmgc.FMGCInternal.arrApt); setprop("autopilot/route-manager/alternate/airport", fmgc.FMGCInternal.altAirport); if (getprop("/autopilot/route-manager/active") != 1) { fgcommand("activate-flightplan", props.Node.new({"activate": 1})); @@ -293,7 +294,7 @@ var updateFuel = func { } # Calculate trip fuel - if (getprop("/FMGC/internal/tofrom-set") and FMGCInternal.crzSet and FMGCInternal.crzTempSet and getprop("/FMGC/internal/zfw-set")) { + if (FMGCInternal.toFromSet and FMGCInternal.crzSet and FMGCInternal.crzTempSet and getprop("/FMGC/internal/zfw-set")) { crz = FMGCInternal.crzFl; temp = FMGCInternal.crzTemp; dist = flightPlanController.arrivalDist; diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index a3909c1b..1c1e2436 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -16,9 +16,6 @@ var DEBUG_DISCONT = 0; # Props.getNode var magHDG = props.globals.getNode("/orientation/heading-magnetic-deg", 1); var trueHDG = props.globals.getNode("/orientation/heading-deg", 1); -var FMGCdep = props.globals.getNode("/FMGC/internal/dep-arpt", 1); -var FMGCarr = props.globals.getNode("/FMGC/internal/arr-arpt", 1); -var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1); # Props.initNode var wpID = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/id", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/id", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/id", "", "STRING")]]; @@ -392,7 +389,7 @@ var flightPlanController = { deleteWP: func(index, n, a = 0, s = 0) { # a = 1, means adding a waypoint via deleting intermediate. s = 1, means autosequencing var wp = wpID[n][index].getValue(); - if (((s == 0 and left(wp, 4) != FMGCdep.getValue() and left(wp, 4) != FMGCarr.getValue()) or (s == 1)) and me.flightplans[n].getPlanSize() > 2) { + if (((s == 0 and left(wp, 4) != FMGCInternal.depApt and left(wp, 4) != FMGCInternal.arrApt) or (s == 1)) and me.flightplans[n].getPlanSize() > 2) { if (me.flightplans[n].getWP(index).id != "DISCONTINUITY" and a == 0) { # if it is a discont, don't make a new one me.flightplans[n].deleteWP(index); fmgc.windController.deleteWind(n, index); @@ -792,12 +789,6 @@ var flightPlanController = { } } - if (left(wpID[n][wpt].getValue(), 4) == FMGCarr.getValue() and wpt != 0) { - if (me.arrivalIndex[n] != wpt) { - me.arrivalIndex[n] = wpt; - } - } - if (wpt > 0) { wpCoursePrev[n][wpt].setValue(me.flightplans[n].getWP(wpt).leg_bearing); wpDistancePrev[n][wpt].setValue(me.flightplans[n].getWP(wpt).leg_distance); @@ -812,8 +803,10 @@ var flightPlanController = { wpDistancePrev[n][wpt].setValue(courseDistanceFrom[1]); } - if (left(wpID[n][wpt].getValue(), 4) == FMGCarr.getValue() and wpt != 0) { - if (me.arrivalIndex[n] != wpt) { # don't merge line 397 and 398 if statements + if (left(wpID[n][wpt].getValue(), 4) == fmgc.FMGCInternal.arrApt and wpt != 0) { + if (me.arrivalIndex[n] != wpt) { + me.arrivalIndex[n] = wpt; + if (canvas_mcdu.myFpln[0] != nil) { canvas_mcdu.myFpln[0].destInfo(); } @@ -828,15 +821,16 @@ var flightPlanController = { if (me.flightplans[2].getWP(me.arrivalIndex[2]) == nil or me.flightplans[2].getWP(1) == nil) { me.arrivalDist = 9999; print(me.arrivalIndex[2]); + } else { + me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist; } - me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist; me.updateMCDUDriver(n); }, updateCurrentWaypoint: func() { for (var india = 0; india <= 2; india += 1) { - if (toFromSet.getBoolValue() and me.flightplans[india].departure != nil and me.flightplans[india].destination != nil) { # check if flightplan exists + if (FMGCInternal.toFromSet and me.flightplans[india].departure != nil and me.flightplans[india].destination != nil) { # check if flightplan exists var curAircraftPos = geo.aircraft_position(); # don't want to get this corrupted so make sure it is a local variable if (india == 2) { # main plan diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index b4c31a92..327b3831 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -316,7 +316,7 @@ var windController = { } if (canvas_mcdu.myCRZWIND[1] != nil) { if (!fmgc.flightPlanController.temporaryFlag[1]) { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[2]) > 0) { canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); canvas_mcdu.myCRZWIND[1].singleCRZ = 0; canvas_mcdu.myCRZWIND[1].cur_location = 0; @@ -326,7 +326,7 @@ var windController = { canvas_mcdu.myCRZWIND[1].cur_location = 0; } } else { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[1]) > 0) { canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[1].getWP(me.nav_indicies[1][0]); canvas_mcdu.myCRZWIND[1].singleCRZ = 0; canvas_mcdu.myCRZWIND[1].cur_location = 0; @@ -340,7 +340,7 @@ var windController = { } if (canvas_mcdu.myCRZWIND[0] != nil) { if (!fmgc.flightPlanController.temporaryFlag[0]) { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[2]) > 0) { canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); canvas_mcdu.myCRZWIND[0].singleCRZ = 0; canvas_mcdu.myCRZWIND[0].cur_location = 0; @@ -350,7 +350,7 @@ var windController = { canvas_mcdu.myCRZWIND[0].cur_location = 0; } } else { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[0]) > 0) { canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[0].getWP(me.nav_indicies[0][0]); canvas_mcdu.myCRZWIND[0].singleCRZ = 0; canvas_mcdu.myCRZWIND[0].cur_location = 0; diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 544339da..42c77275 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -218,7 +218,7 @@ var fuelPredInput = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } - if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { + if (!getprop("/FMGC/internal/cost-index-set") and fmgc.FMGCInternal.toFromSet) { mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index") or 0); setprop("/FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index") or 0); diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index d066f74e..0e2ad0cf 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -19,12 +19,12 @@ var initInputA = func(key, i) { #} else if (scratchpad == "") { #fmgc.FMGCInternal.altSelected = 1; #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); - } else if (getprop("/FMGC/internal/tofrom-set") == 1) { + } else if (fmgc.FMGCInternal.toFromSet) { if (!fmgc.flightPlanController.temporaryFlag[i]) { var tfs = size(scratchpad); if (tfs == 4) { fmgc.FMGCInternal.altAirport = scratchpad; - fmgc.FMGCInternal.altAirportSet = 0; + fmgc.FMGCInternal.altAirportSet = 1; fmgc.windController.updatePlans(); if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 0); @@ -169,9 +169,10 @@ var initInputA = func(key, i) { } } else if (key == "R1") { if (scratchpad == "CLR") { - setprop("/FMGC/internal/dep-arpt", ""); - setprop("/FMGC/internal/arr-arpt", ""); - setprop("/FMGC/internal/tofrom-set", 0); + fmgc.FMGCInternal.depApt = ""; + fmgc.FMGCInternal.arrApt = ""; + fmgc.FMGCInternal.toFromSet = 0; + fmgc.FMGCNodes.toFromSet.setValue(0); setprop("/FMGC/internal/align-ref-lat", 0); setprop("/FMGC/internal/align-ref-long", 0); setprop("/FMGC/internal/align-ref-lat-edit", 0); @@ -197,9 +198,10 @@ var initInputA = func(key, i) { var tos = size(fromto[1]); if (froms == 4 and tos == 4) { #route - setprop("/FMGC/internal/dep-arpt", fromto[0]); - setprop("/FMGC/internal/arr-arpt", fromto[1]); - setprop("/FMGC/internal/tofrom-set", 1); + fmgc.FMGCInternal.depApt = fromto[0]; + fmgc.FMGCInternal.arrApt = fromto[1]; + fmgc.FMGCInternal.toFromSet = 1; + fmgc.FMGCNodes.toFromSet.setValue(1); #scratchpad mcdu_scratchpad.scratchpads[i].empty(); fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2); @@ -247,7 +249,7 @@ var initInputA = func(key, i) { } else if (key == "R5") { if (scratchpad == "CLR") { fmgc.FMGCInternal.tropo = 36090; - fmgc.FMGCInternal.tropoSet = 1; + fmgc.FMGCInternal.tropoSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { var tropo = size(scratchpad); diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 0a3231a8..17c259bd 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -233,7 +233,7 @@ var initInputB = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } - if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { + if (!getprop("/FMGC/internal/cost-index-set") and fmgc.FMGCInternal.toFromSet) { mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index") or 0); setprop("/FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index") or 0); diff --git a/Nasal/MCDU/IRSINIT.nas b/Nasal/MCDU/IRSINIT.nas index 7ba66c6b..baabec0b 100644 --- a/Nasal/MCDU/IRSINIT.nas +++ b/Nasal/MCDU/IRSINIT.nas @@ -62,7 +62,7 @@ var initInputIRS = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } else if (key == "L1") { - if (getprop("FMGC/internal/tofrom-set")) { + if (fmgc.FMGCInternal.toFromSet) { setprop("FMGC/internal/align-ref-lat-edit", 1); setprop("FMGC/internal/align-ref-long-edit", 0); } else { @@ -73,7 +73,7 @@ var initInputIRS = func(key, i) { setprop("FMGC/internal/align-ref-long-edit", 0); setprop("MCDU[" ~ i ~ "]/page", "INITA"); } else if (key == "R1") { - if (getprop("FMGC/internal/tofrom-set")) { + if (fmgc.FMGCInternal.toFromSet) { setprop("FMGC/internal/align-ref-lat-edit", 0); setprop("FMGC/internal/align-ref-long-edit", 1); } else { @@ -82,7 +82,7 @@ var initInputIRS = func(key, i) { } else if (key == "R6") { setprop("FMGC/internal/align-ref-lat-edit", 0); setprop("FMGC/internal/align-ref-long-edit", 0); - if (getprop("FMGC/internal/tofrom-set") == 1 and getprop("systems/navigation/adr/any-adr-on") == 1) { + if (fmgc.FMGCInternal.toFromSet and getprop("systems/navigation/adr/any-adr-on") == 1) { if (getprop("FMGC/internal/align-set") == 0) { setprop("FMGC/internal/align-set", 1); } else { @@ -90,7 +90,7 @@ var initInputIRS = func(key, i) { setprop("FMGC/internal/align-set", 0); setprop("MCDU[" ~ i ~ "]/page", "INITA"); } - } else if (getprop("FMGC/internal/tofrom-set") == 0) { + } else if (!fmgc.FMGCInternal.toFromSet) { # setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT REFERENCE"); } else if (getprop("systems/navigation/adr/any-adr-on") == 0) { # setprop("MCDU[" ~ i ~ "]/scratchpad", "IRS NOT ALIGNED"); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 00ad0f45..1adf71d7 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -52,9 +52,10 @@ var MCDU_reset = func(i) { # INT-A fmgc.FMGCInternal.flightNum = ""; fmgc.FMGCInternal.flightNumSet = 0; - setprop("/FMGC/internal/dep-arpt", ""); - setprop("/FMGC/internal/arr-arpt", ""); - setprop("/FMGC/internal/tofrom-set", 0); + fmgc.FMGCInternal.arrApt = ""; + fmgc.FMGCInternal.depApt = ""; + fmgc.FMGCInternal.toFromSet = 0; + fmgc.FMGCNodes.toFromSet.setValue(0); fmgc.FMGCInternal.altAirport = ""; fmgc.FMGCInternal.altAirportSet = 0; setprop("/FMGC/internal/cost-index", "0"); @@ -611,7 +612,7 @@ var rskbutton = func(btn, i) { setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { if (fmgc.flightPlanController.temporaryFlag[i]) { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[i]) > 0) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[i]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { canvas_mcdu.myCRZWIND[i].del(); } @@ -625,7 +626,7 @@ var rskbutton = func(btn, i) { } } } else { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[2]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { canvas_mcdu.myCRZWIND[i].del(); } @@ -664,7 +665,7 @@ var rskbutton = func(btn, i) { initInputB("R5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { if (fmgc.flightPlanController.temporaryFlag[i]) { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[i]) > 0) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[i]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { canvas_mcdu.myCRZWIND[i].del(); } @@ -678,7 +679,7 @@ var rskbutton = func(btn, i) { } } } else { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[2]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { canvas_mcdu.myCRZWIND[i].del(); } diff --git a/Nasal/MCDU/PROGCLB.nas b/Nasal/MCDU/PROGCLB.nas index fcb746e3..ef868d1f 100644 --- a/Nasal/MCDU/PROGCLB.nas +++ b/Nasal/MCDU/PROGCLB.nas @@ -14,7 +14,7 @@ var progCLBInput = func(key, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); - if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { fmgc.FMGCInternal.crzProg = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); if (getprop("/FMGC/status/phase") == 5) { diff --git a/Nasal/MCDU/PROGCRZ.nas b/Nasal/MCDU/PROGCRZ.nas index f3e761e8..a6b142cf 100644 --- a/Nasal/MCDU/PROGCRZ.nas +++ b/Nasal/MCDU/PROGCRZ.nas @@ -14,7 +14,7 @@ var progCRZInput = func(key, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); - if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { fmgc.FMGCInternal.crzProg = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); if (getprop("/FMGC/status/phase") == 5) { diff --git a/Nasal/MCDU/PROGDES.nas b/Nasal/MCDU/PROGDES.nas index c40824bf..a16fb07a 100644 --- a/Nasal/MCDU/PROGDES.nas +++ b/Nasal/MCDU/PROGDES.nas @@ -14,7 +14,7 @@ var progDESInput = func(key, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); - if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { fmgc.FMGCInternal.crzProg = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { diff --git a/Nasal/MCDU/PROGTO.nas b/Nasal/MCDU/PROGTO.nas index da7244e7..5e0f96d4 100644 --- a/Nasal/MCDU/PROGTO.nas +++ b/Nasal/MCDU/PROGTO.nas @@ -10,7 +10,7 @@ var progTOInput = func(key, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); - if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and fmgc.FMGCInternal.crzSet) { + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100 and fmgc.FMGCInternal.crzSet) { fmgc.FMGCInternal.crzProg = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); } else {