1
0
Fork 0
A320-family/Nasal/MCDU/PERFCLB.nas

36 lines
986 B
Text
Raw Normal View History

2019-10-14 16:48:35 +00:00
# A3XX mCDU by Joshua Davidson (Octal450) and Jonathan Redpath
# Copyright (c) 2019 Joshua Davidson (Octal450)
var perfCLBInput = func(key, i) {
2020-02-07 16:10:54 +00:00
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
2019-10-14 16:48:35 +00:00
if (key == "L5") {
if (scratchpad == "CLR") {
2020-02-07 16:10:54 +00:00
setprop("FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
2019-10-14 16:48:35 +00:00
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci == nil) {
notAllowed(i);
} else if (ci >= 0 and ci <= 999) {
2020-02-07 16:10:54 +00:00
setprop("FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
2019-10-14 16:48:35 +00:00
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
}
} else if (key == "L6") {
2020-02-07 16:10:54 +00:00
setprop("MCDU[" ~ i ~ "]/page", "TO");
2019-10-14 16:48:35 +00:00
} else if (key == "R6") {
2020-02-07 16:10:54 +00:00
setprop("MCDU[" ~ i ~ "]/page", "CRZ");
2019-10-14 16:48:35 +00:00
}
}