From 6f698bf47363b0a1c788735f8b10289d2280ea13 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 25 May 2020 23:33:06 +0100 Subject: [PATCH] Will check distance before deleting waypoint. This seems more reliable, in DIRTO --- Nasal/FMGC/flightplan.nas | 5 ++--- Nasal/MCDU/DIRTO.nas | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 00bfeb3e..8cd23e7c 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -320,7 +320,6 @@ var flightPlanController = { # we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later. # example - waypoint dirto is index 5, we want to delete indexes 1 -> 4. 5 - 1 = 4. # so four individual deletions. Delete index 1 four times. - # Add one extra for the TP, so while > 2 var timesToDelete = me.flightplans[plan].indexOfWP(waypointGhost); while (timesToDelete > 1) { @@ -330,9 +329,9 @@ var flightPlanController = { # Add TP afterwards, this is essential me.insertTP(plan, 1); } - me.deleteWP(0, plan); var curAircraftPosDirTo = geo.aircraft_position(); - canvas_mcdu.myDirTo[plan].updateDist(me.flightplans[plan].getWP(1).courseAndDistanceFrom(curAircraftPosDirTo)[1]); + canvas_mcdu.myDirTo[plan].updateDist(me.flightplans[plan].getWP(2).courseAndDistanceFrom(curAircraftPosDirTo)[1]); + me.deleteWP(0, plan); me.flightPlanChanged(plan); }, diff --git a/Nasal/MCDU/DIRTO.nas b/Nasal/MCDU/DIRTO.nas index 52e67dac..4d803bb3 100644 --- a/Nasal/MCDU/DIRTO.nas +++ b/Nasal/MCDU/DIRTO.nas @@ -148,6 +148,7 @@ var dirTo = { fieldL1: func(text, override = 0, overrideIndex = -1) { me.makeTmpy(); me.L1[0] = text; + me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]]; if (size(text) == 16) { # lat lon var lat = split("/", text)[0]; @@ -237,6 +238,7 @@ var dirTo = { leftFieldBtn: func(index) { me.makeTmpy(); me.L1[0] = me.vector[index - 2].wp_name; + me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]]; fmgc.flightPlanController.directTo(me.vector[index - 2], me.computer); me.arrowsMatrix[0][1] = 0; # FIGURE OUT HOW TO MAKE IT SO IT DOESN'T DELETE THE WAYPOINTS ON DIR TO BUT DOES IN FLIGHTPLAN @@ -256,6 +258,7 @@ var dirTo = { notAllowed(me.computer); } me.L1 = [" [ ]", " WAYPOINT", "blu"]; + me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]]; me.R1 = ["---- --- ", "UTC DIST ", "wht"]; }, fieldR6: func() { @@ -266,6 +269,7 @@ var dirTo = { notAllowed(me.computer); } me.L1 = [" [ ]", " WAYPOINT", "blu"]; + me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]]; me.R1 = ["---- --- ", "UTC DIST ", "wht"]; setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna? },