From 933cc91e4df006ce3154b1930104c87fbbf3f1d4 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 7 Apr 2020 17:08:26 +0100 Subject: [PATCH] Inhibit spawning arrival / departure with bad LATREV page type --- Nasal/MCDU/MCDU.nas | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 29f8b7d5..22bb1e82 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -115,12 +115,16 @@ var lskbutton = func(btn, i) { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { printInput2("L1", i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") { - if (canvas_mcdu.myDeparture[i] != nil) { - canvas_mcdu.myDeparture[i].del(); - } - canvas_mcdu.myDeparture[i] = nil; - canvas_mcdu.myDeparture[i] = departurePage.new(canvas_mcdu.myLatRev[i].title[2], i); - setprop("MCDU[" ~ i ~ "]/page", "DEPARTURE"); + if (canvas_mcy.myLatRev[i].type == 0) { + if (canvas_mcdu.myDeparture[i] != nil) { + canvas_mcdu.myDeparture[i].del(); + } + canvas_mcdu.myDeparture[i] = nil; + canvas_mcdu.myDeparture[i] = departurePage.new(canvas_mcdu.myLatRev[i].title[2], i); + setprop("MCDU[" ~ i ~ "]/page", "DEPARTURE"); + } else { + notAllowed(i); + } } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(1); } else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") { @@ -300,12 +304,16 @@ var rskbutton = func(btn, i) { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { printInput2("R1", i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "LATREV") { - if (canvas_mcdu.myArrival[i] != nil) { - canvas_mcdu.myArrival[i].del(); - } - canvas_mcdu.myArrival[i] = nil; - canvas_mcdu.myArrival[i] = arrivalPage.new(canvas_mcdu.myLatRev[i].title[2], i); - setprop("MCDU[" ~ i ~ "]/page", "ARRIVAL"); + if (canvas_mcy.myLatRev[i].type == 1) { + if (canvas_mcdu.myArrival[i] != nil) { + canvas_mcdu.myArrival[i].del(); + } + canvas_mcdu.myArrival[i] = nil; + canvas_mcdu.myArrival[i] = arrivalPage.new(canvas_mcdu.myLatRev[i].title[2], i); + setprop("MCDU[" ~ i ~ "]/page", "ARRIVAL"); + } else { + notAllowed(i); + } } else if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(1); } else {