From 0ef5d73f14cd185e7bb93c60fa9667ee042a422c Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 24 Apr 2020 12:44:39 +0100 Subject: [PATCH] LATREV: pass the ghost, not identifier. Fix the L6 LAT REV spawn on f-pln page. Change (1500) to 1500 -- we need to remove parenthases on the SID waypoints too, but how? --- Nasal/FMGC/flightplan.nas | 4 ++-- Nasal/MCDU/F-PLN.nas | 20 ++++++++++---------- Nasal/MCDU/LATREV.nas | 33 +++++++++++++-------------------- 3 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 10a42081..9d02d59c 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -196,11 +196,11 @@ var flightPlanController = { insertNOSID: func(n) { var wptStore = me.flightplans[n].getWP(0); if (wptStore.wp_type == "runway") { - if (me.flightplans[n].getWP(1).id == "(1500)") { # check if we have NO SID already loaded + if (me.flightplans[n].getWP(1).id == "1500") { # check if we have NO SID already loaded me.deleteWP(1, n, 1); } # fudge the altitude since we cannot create a hdgtoAlt from nasal. Assume 600 feet per mile - 2.5 miles - me.flightplans[n].insertWP(me.childWPBearingDistance(wptStore, me.flightplans[n].departure_runway.heading, 2.5, "(1500)", "sid"), 1); + me.flightplans[n].insertWP(me.childWPBearingDistance(wptStore, me.flightplans[n].departure_runway.heading, 2.5, "1500", "sid"), 1); } me.flightPlanChanged(n); }, diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index dc135e5a..b78f1483 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -89,26 +89,26 @@ var fplnItem = { canvas_mcdu.myLatRev[me.computer] = nil; if (me.wp.wp_name == "DISCONTINUITY") { - canvas_mcdu.myLatRev[me.computer] = latRev.new(4, "DISCON", me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(4, me.wp, me.index, me.computer); } elsif (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) { - canvas_mcdu.myLatRev[me.computer] = latRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(1, me.wp, me.index, me.computer); } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) { - canvas_mcdu.myLatRev[me.computer] = latRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(0, me.wp, me.index, me.computer); } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { - canvas_mcdu.myLatRev[me.computer] = latRev.new(2, me.wp.wp_name, me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(2, me.wp, me.index, me.computer); } else { - canvas_mcdu.myLatRev[me.computer] = latRev.new(3, me.wp.wp_name, me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(3, me.wp, me.index, me.computer); } } else { if (me.index == fmgc.flightPlanController.arrivalIndex[2]) { - canvas_mcdu.myLatRev[me.computer] = latRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(1, me.wp, me.index, me.computer); } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) { - canvas_mcdu.myLatRev[me.computer] = latRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(0, me.wp, me.index, me.computer); } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { - canvas_mcdu.myLatRev[me.computer] = latRev.new(2, me.wp.wp_name, me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(2, me.wp, me.index, me.computer); } else { - canvas_mcdu.myLatRev[me.computer] = latRev.new(3, me.wp.wp_name, me.index, me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(3, me.wp, me.index, me.computer); } } setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV"); @@ -353,7 +353,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th canvas_mcdu.myLatRev[me.computer].del(); } canvas_mcdu.myLatRev[me.computer] = nil; - canvas_mcdu.myLatRev[me.computer] = latRev.new(1, me.L6[0], fmgc.flightPlanController.arrivalIndex[me.computer], me.computer); + canvas_mcdu.myLatRev[me.computer] = latRev.new(1, fmgc.flightPlanController.flightplans[2].getWP(fmgc.flightPlanController.arrivalIndex[2]), fmgc.flightPlanController.arrivalIndex[2], me.computer); setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV"); } } else { diff --git a/Nasal/MCDU/LATREV.nas b/Nasal/MCDU/LATREV.nas index ae41e593..266b2a23 100644 --- a/Nasal/MCDU/LATREV.nas +++ b/Nasal/MCDU/LATREV.nas @@ -20,11 +20,10 @@ var latRev = { arrAirport: nil, index: nil, computer: nil, - wpt: nil, - new: func(type, id, index, computer) { + new: func(type, wpt, index, computer) { var lr = {parents:[latRev]}; lr.type = type; # 0 = origin 1 = destination 2 = ppos (from waypoint) 3 = generic wpt, 4 = discon - lr.id = id; + lr.wpt = wpt; lr.index = index; lr.computer = computer; lr._setupPageWithData(); @@ -64,13 +63,12 @@ var latRev = { me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]]; } else { - me.title = ["LAT REV", " FROM ", me.id]; - if (me.type == 0) { - if (size(me.id) > 4) { - me.depAirport = findAirportsByICAO(left(me.id, 4)); + me.title = ["LAT REV", " FROM ", left(me.wpt.wp_name, 4)]; + if (size(me.wpt.wp_name) > 4) { + me.depAirport = findAirportsByICAO(left(me.wpt.wp_name, 4)); } else { - me.depAirport = findAirportsByICAO(me.id); + me.depAirport = findAirportsByICAO(me.wpt.wp_name); } me.subtitle = [dmsToString(sprintf(me.depAirport[0].lat), "lat"), dmsToString(sprintf(me.depAirport[0].lon), "lon")]; me.L1 = [" DEPARTURE", nil, "wht"]; @@ -84,10 +82,11 @@ var latRev = { me.arrowsColour = [["wht", "wht", "ack", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0]]; } elsif (me.type == 1) { - if (size(me.id) > 4) { - me.arrAirport = findAirportsByICAO(left(me.id, 4)); + me.title = ["LAT REV", " FROM ", left(me.wpt.wp_name, 4)]; + if (size(me.wpt.wp_name) > 4) { + me.arrAirport = findAirportsByICAO(left(me.wpt.wp_name, 4)); } else { - me.arrAirport = findAirportsByICAO(me.id); + me.arrAirport = findAirportsByICAO(me.wpt.wp_name); } me.subtitle = [dmsToString(sprintf(me.arrAirport[0].lat), "lat"), dmsToString(sprintf(me.arrAirport[0].lon), "lon")]; me.L3 = [" ALTN", nil, "wht"]; @@ -99,15 +98,9 @@ var latRev = { me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0]]; } elsif (me.type == 3) { - if (size(me.id) == 2 or size(me.id) == 3) { - me.wpt = findNavaidsByID(me.id); - } elsif (size(me.id) == 4) { - me.wpt = findAirportsByICAO(me.id); - } elsif (size(me.id) == 5) { - me.wpt = findFixesByID(me.id); - } - if (me.wpt[0] != nil) { - me.subtitle = [dmsToString(sprintf(me.wpt[0].lat), "lat"), dmsToString(sprintf(me.wpt[0].lon), "lon")]; + me.title = ["LAT REV", " FROM ", me.wpt.wp_name]; + if (me.wpt != nil) { + me.subtitle = [dmsToString(sprintf(me.wpt.lat), "lat"), dmsToString(sprintf(me.wpt.lon), "lon")]; } me.L3 = [" HOLD", nil, "wht"]; me.L4 = [" ALTN", " ENABLE", "blu"];