From 7caf5a676e3a2e5ab32a28abcc892beebe4848e8 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 19 Mar 2020 18:09:27 +0000 Subject: [PATCH] bugfixes --- Models/Instruments/MCDU/MCDU.nas | 16 +-- Nasal/MCDU/F-PLN-rework.nas | 3 +- Nasal/MCDU/F-PLN.nas | 196 ------------------------------- 3 files changed, 10 insertions(+), 205 deletions(-) delete mode 100644 Nasal/MCDU/F-PLN.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index be5351b3..3a335b77 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -181,14 +181,13 @@ var canvas_MCDU_base = { }, getKeys: func() { return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4" - ,"Simple_L5","Simple_L6","Simple_L1S","Simple_L2S","Simple_L3S","Simple_L4S","Simple_L5S","Simple_L6S", "Simple_L1_Arrow","Simple_L2_Arrow", - "Simple_L3_Arrow","Simple_L4_Arrow","Simple_L5_Arrow","Simple_L6_Arrow","Simple_R1","Simple_R2","Simple_R3","Simple_R4","Simple_R5","Simple_R6", - "Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow","Simple_R4_Arrow", - "Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C4","Simple_C5","Simple_C6","Simple_C1S","Simple_C2S","Simple_C3S", - "Simple_C4S","Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp","INITA_FromTo", - "INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2", - "PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR","PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","FPLN","FPLN_From","FPLN_TMPY_group","FPLN_Callsign", - "departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R","arrow3R","arrow4R","arrow5R"]; + ,"Simple_L5","Simple_L6","Simple_L0S","Simple_L1S","Simple_L2S","Simple_L3S","Simple_L4S","Simple_L5S","Simple_L6S", "Simple_L1_Arrow", + "Simple_L2_Arrow","Simple_L3_Arrow","Simple_L4_Arrow","Simple_L5_Arrow","Simple_L6_Arrow","Simple_R1","Simple_R2","Simple_R3","Simple_R4","Simple_R5", + "Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow", + "Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C4","Simple_C5","Simple_C6","Simple_C1S", + "Simple_C2S","Simple_C3S","Simple_C4S","Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp", + "INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR","PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","FPLN","FPLN_From","FPLN_TMPY_group", + "FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R","arrow3R","arrow4R","arrow5R"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -239,6 +238,7 @@ var canvas_MCDU_base = { me.fontRightS(default, default, default, default, default, default); me.fontSizeLeft(normal, normal, normal, normal, normal, normal); + me.fontSizeCenter(normal, normal, normal, normal, normal, normal); me.fontSizeRight(normal, normal, normal, normal, normal, normal); pageSwitch[i].setBoolValue(1); } diff --git a/Nasal/MCDU/F-PLN-rework.nas b/Nasal/MCDU/F-PLN-rework.nas index a7d38f8d..b720ed79 100644 --- a/Nasal/MCDU/F-PLN-rework.nas +++ b/Nasal/MCDU/F-PLN-rework.nas @@ -106,13 +106,13 @@ var fplnItem = { canvas_mcdu.myVertRev[me.computer].del(); } canvas_mcdu.myVertRev[me.computer] = nil; - notAllowed(me.computer); if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) { canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer); } if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) { notAllowed(me.computer); + return; } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer); } else { @@ -123,6 +123,7 @@ var fplnItem = { canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer); } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) { notAllowed(me.computer); + return; } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer); } else { diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas deleted file mode 100644 index 52398beb..00000000 --- a/Nasal/MCDU/F-PLN.nas +++ /dev/null @@ -1,196 +0,0 @@ - - pushButtonLeft: func() { - if (me.type != "discontinuity") { - notAllowed(me.computer.mcdu); - } else { - var scratchpad = getprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad"); - if (me.computer.lines == MAIN and scratchpad != "CLR" and scratchpad != "") { - fmgc.flightPlanController.createTemporaryFlightPlan(me.computer.mcdu); - } - if (fmgc.flightPlanController.temporaryFlag[me.computer.mcdu]) { - if (scratchpad == "CLR") { - if (fmgc.flightPlanController.deleteWP(me.index, me.computer.mcdu, 0) != 0) { - notAllowed(me.computer.mcdu); - } else { - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", ""); - } - } elsif (size(scratchpad) == 5) { - var fix = findFixesByID(scratchpad); - if (size(fix) >= 1) { - var indexWp = fmgc.flightPlanController.flightplans[me.computer.mcdu].indexOfWP(fix[0]); - if (indexWp == -1) { - var insertReturn = fmgc.flightPlanController.insertFix(scratchpad, me.index, me.computer.mcdu); - fmgc.flightPlanController.flightPlanChanged(me.computer.mcdu); - } else { - var numTimesDelete = indexWp - me.index; - while (numTimesDelete > 0) { - fmgc.flightPlanController.deleteWP(me.index + 1, me.computer.mcdu, 0); - numTimesDelete -= 1; - } - } - if (insertReturn == 2) { - notAllowed(me.computer.mcdu); - } else if (insertReturn == 1) { - notInDataBase(me.computer.mcdu); - } else { - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", ""); - } - } else { - notInDataBase(me.computer.mcdu); - } - } else if (size(scratchpad) == 4) { - var arpt = findAirportsByICAO(scratchpad); - if (size(arpt) >= 1) { - var indexWp = fmgc.flightPlanController.flightplans[me.computer.mcdu].indexOfWP(arpt[0]); - if (indexWp == -1) { - var insertReturn = fmgc.flightPlanController.insertArpt(scratchpad, me.index, me.computer.mcdu); - fmgc.flightPlanController.flightPlanChanged(me.computer.mcdu); - } else { - var numTimesDelete = indexWp - me.index; - while (numTimesDelete > 0) { - fmgc.flightPlanController.deleteWP(me.index + 1, me.computer.mcdu, 0); - numTimesDelete -= 1; - } - } - if (insertReturn == 2) { - notAllowed(me.computer.mcdu); - } else if (insertReturn == 1) { - notInDataBase(me.computer.mcdu); - } else { - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", ""); - } - } else { - notInDataBase(me.computer.mcdu); - } - } else if (size(scratchpad) == 3 or size(scratchpad) == 2) { - var navaid = findNavaidsByID(scratchpad); - if (size(navaid) >= 1) { - var indexWp = fmgc.flightPlanController.flightplans[me.computer.mcdu].indexOfWP(navaid[0]); - if (indexWp == -1) { - var insertReturn = fmgc.flightPlanController.insertNavaid(scratchpad, me.index, me.computer.mcdu); - fmgc.flightPlanController.flightPlanChanged(me.computer.mcdu); - } else { - var numTimesDelete = indexWp - me.index; - while (numTimesDelete > 0) { - fmgc.flightPlanController.deleteWP(me.index + 1, me.computer.mcdu, 0); - numTimesDelete -= 1; - } - } - if (insertReturn == 2) { - notAllowed(me.computer.mcdu); - } else if (insertReturn == 1) { - notInDataBase(me.computer.mcdu); - } else { - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", ""); - } - } else { - notInDataBase(me.computer.mcdu); - } - } elsif (scratchpad == "") { - if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) { - canvas_mcdu.myLatRev[me.computer.mcdu].del(); - } - canvas_mcdu.myLatRev[me.computer.mcdu] = nil; - canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(4, "DISCON", me.index, me.computer.mcdu); - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/page", "LATREV"); - } else { - notAllowed(me.computer.mcdu); - } - } else { - if (scratchpad == "CLR") { - if (fmgc.flightPlanController.deleteWP(me.index, 2, 0) != 0) { - notAllowed(me.computer.mcdu); - } else { - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad-msg", 0); - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", ""); - } - } elsif (size(scratchpad) != 0) { - me.pushButtonLeft(); - } elsif (scratchpad == "") { - if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) { - canvas_mcdu.myLatRev[me.computer.mcdu].del(); - } - canvas_mcdu.myLatRev[me.computer.mcdu] = nil; - canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(4, "DISCON", me.index, me.computer.mcdu); - setprop("/MCDU[" ~ me.computer.mcdu ~ "]/page", "LATREV"); - } else { - notAllowed(me.computer.mcdu); - } - } - } - }, - -var FPLNLineComputer = { - new: func(mcdu) { - var in = {parents:[FPLNLineComputer]}; - in.mcdu = mcdu; - in.planEnd = StaticText.new(in, "fplnEnd"); - in.planNoAlt = StaticText.new(in, "noAltnFpln"); - if (debug == 1) printf("%d: Line computer created.", in.mcdu); - return in; - }, - index: 0, - planList: [], - destination: nil, - destIndex: nil, - planEnd: nil, - planNoAlt: nil, - lines: nil, - output: [], - mcdu: nil, - fplnID: nil, - enableScroll: 0, - clear: func() { - me.planList = []; - me.destIndex = -1; - me.destination = nil; - me.index = 0; - me.output = []; - me.enableScroll = 0; - if (me.lines == nil) { - me.lines = MAIN; - } - me.updateScroll(); - }, - replacePlan: func(fplnID, lines, firstLineIndex) { - # Here you set another plan, do this when changing plan on display or when destination changes - if (debug == 1) printf("%d: replacePlan called for %d lines and firstLine %d", me.mcdu, lines, firstLineIndex); - var fpln = nil; - - me.planList = []; - - if (!fmgc.flightPlanController.active.getBoolValue()) { - me.destIndex = -1; - me.destination = nil; - } else { - fpln = fmgc.flightPlanController.flightplans[fplnID]; # Get the Nasal Flightplan - me.destIndex = fmgc.flightPlanController.arrivalIndex[fplnID]; - me.destination = FPLNText.new(me, fpln.getWP(me.destIndex), 1, fplnID, me.destIndex); - for (var j = 0; j < fpln.getPlanSize(); j += 1) { - me.dest = 0; - if (j == me.destIndex) { - me.dest = 1; - } - var wpt = fpln.getWP(j); - if (wpt.wp_name == "DISCONTINUITY") { - append(me.planList, StaticText.new(me, "discontinuity", j)); - } else { - append(me.planList, FPLNText.new(me, fpln.getWP(j), me.dest, fplnID, j)); - } - } - if (debug == 1) printf("%d: dest is: %s", me.mcdu, fpln.getWP(me.destIndex).wp_name); - } - me.index = firstLineIndex; - me.lines = lines; - me.initScroll(); - }, - initScroll: func() { - me.maxItems = size(me.planList) + 2; # + 2 is for end of plan line and altn end of plan. - me.enableScroll = me.lines < me.maxItems; - me.checkIndex(); - if (debug == 1) printf("%d: scroll is %d. Size of plan is %d", me.mcdu, me.enableScroll, size(me.planList)); - me.updateScroll(); - }, -}; -