From 1f44ce74c60a14cdfbd352bb5125271f8dd40ec2 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 13 Jan 2022 21:33:12 +0000 Subject: [PATCH] Only allow ovfy once --- Nasal/MCDU/MCDU.nas | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 55c0df44..d28566ef 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -1528,11 +1528,18 @@ var button = func(btn, i, event = "") { if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "-") { mcdu_scratchpad.scratchpads[i].clear(); mcdu_scratchpad.scratchpads[i].addChar("+"); + } else if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "+") { + mcdu_scratchpad.scratchpads[i].clear(); + mcdu_scratchpad.scratchpads[i].addChar("-"); } else { mcdu_scratchpad.scratchpads[i].addChar("-"); } } else if (btn == "OVFY") { - mcdu_scratchpad.scratchpads[i].addChar("@"); + if (mcdu_scratchpad.scratchpads[i].scratchpad == "") { + mcdu_scratchpad.scratchpads[i].addChar("@"); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_scratchpad.scratchpads[i].addChar(btn); }