From b732eda7bcad0ce286d541115bf5d8442c996603 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 25 Jan 2022 19:22:40 +0000 Subject: [PATCH] Fix for fpln --- Nasal/MCDU/F-PLN.nas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 296b8d11..8a1f25b9 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -535,15 +535,18 @@ var fplnPage = { # this one is only created once, and then updated - remember th setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV"); } } else { - if (size(me.outputList) >= index and !mcdu_scratchpad.scratchpads[me.computer].showTypeIMsg and !mcdu_scratchpad.scratchpads[me.computer].showTypeIIMsg) { + if ((index - 1 + me.scroll) < size(me.planList) and !mcdu_scratchpad.scratchpads[me.computer].showTypeIMsg and !mcdu_scratchpad.scratchpads[me.computer].showTypeIIMsg) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) > 0) { + + # Use outputList.index to correct the index the call goes to after sequencing + if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") { - if (me.outputList[index - 1 + me.scroll].wp.wp_name == "(DECEL)") { + if (me.outputList[index - 1].wp.wp_name == "(DECEL)") { mcdu_message(me.computer, "NOT ALLOWED"); return; } } - var returny = fmgc.flightPlanController.scratchpad(mcdu_scratchpad.scratchpads[me.computer].scratchpad, (index - 1 + me.scroll), me.computer); + var returny = fmgc.flightPlanController.scratchpad(mcdu_scratchpad.scratchpads[me.computer].scratchpad, me.outputList[index - 1].index, me.computer); if (returny == 3) { mcdu_message(me.computer, "DIR TO IN PROGRESS"); } elsif (returny == 0) {