Switch to forindex() (thanks pinto) and messages cleared when vector is empty
This commit is contained in:
parent
e69ae365c2
commit
6669becaff
2 changed files with 14 additions and 15 deletions
|
@ -77,6 +77,8 @@ var messages_priority_3 = func {
|
|||
if (getprop("/controls/flight/flap-pos") > 2 and getprop("/position/gear-agl-ft") < 750 and getprop("/gear/gear[1]/position-norm") != 1 and getprop("/FMGC/status/phase") == 5) {
|
||||
msgs_priority_3.append("L/G GEAR NOT DOWN");
|
||||
active_messages.append("L/G GEAR NOT DOWN");
|
||||
} else if (active_messages.contains("L/G GEAR NOT DOWN")) {
|
||||
active_messages.remove("L/G GEAR NOT DOWN");
|
||||
}
|
||||
}
|
||||
var messages_priority_2 = func {}
|
||||
|
@ -86,6 +88,8 @@ var messages_memo = func {
|
|||
if (getprop("controls/flight/speedbrake-arm") == 1) {
|
||||
msgs_memo.append("GND SPLRS ARMED");
|
||||
active_messages.append("GND SPLRS ARMED");
|
||||
} else if (active_messages.contains("GND SPLRS ARMED")) {
|
||||
active_messages.remove("GND SPLRS ARMED");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,24 +115,19 @@ var ECAM_controller = {
|
|||
messages_memo();
|
||||
|
||||
# write to ECAM
|
||||
foreach(var ewd_messages; active_messages.vector) {
|
||||
var i = 1;
|
||||
var x = getprop("/ECAM/msg/line" ~ i);
|
||||
print("Variable i is:" ~ i);
|
||||
if (x == "") {
|
||||
setprop("/ECAM/msg/line" ~ i, ewd_messages);
|
||||
|
||||
forindex ( var i; active_messages.vector ) {
|
||||
var line = 1;
|
||||
if (getprop("/ECAM/msg/line" ~ line) == "") {
|
||||
setprop("/ECAM/msg/line" ~ line, active_messages.vector[i]);
|
||||
} else {
|
||||
i = i + 1;
|
||||
setprop("/ECAM/msg/line" ~ i, ewd_messages);
|
||||
print("Variable i is:" ~ i);
|
||||
setprop("/ECAM/msg/line" ~ (line + 1), active_messages.vector[i]);
|
||||
}
|
||||
}
|
||||
|
||||
# debug
|
||||
|
||||
foreach(var debug; active_messages.vector) {
|
||||
print(debug);
|
||||
if (active_messages.size() == 0) {
|
||||
setprop("/ECAM/msg/line1", "");
|
||||
setprop("/ECAM/msg/line2", "");
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
|
|
|
@ -80,7 +80,7 @@ var ECAM = {
|
|||
setprop("/ECAM/ldg-memo-enable", 0);
|
||||
}
|
||||
|
||||
if (size(ecam.active_messages) > 0) {
|
||||
if (ecam.active_messages.size() > 0) {
|
||||
setprop("/ECAM/left-msg", "MSG");
|
||||
} else if (getprop("/FMGC/status/phase") == 0 and stateL == 3 and stateR == 3 and getprop("/ECAM/engine-start-time") + 120 < getprop("/sim/time/elapsed-sec") and getprop("/ECAM/to-memo-enable") == 1 and wow == 1) {
|
||||
setprop("/ECAM/left-msg", "TO-MEMO");
|
||||
|
|
Reference in a new issue