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) {
|
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");
|
msgs_priority_3.append("L/G GEAR NOT DOWN");
|
||||||
active_messages.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 {}
|
var messages_priority_2 = func {}
|
||||||
|
@ -86,6 +88,8 @@ var messages_memo = func {
|
||||||
if (getprop("controls/flight/speedbrake-arm") == 1) {
|
if (getprop("controls/flight/speedbrake-arm") == 1) {
|
||||||
msgs_memo.append("GND SPLRS ARMED");
|
msgs_memo.append("GND SPLRS ARMED");
|
||||||
active_messages.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();
|
messages_memo();
|
||||||
|
|
||||||
# write to ECAM
|
# write to ECAM
|
||||||
foreach(var ewd_messages; active_messages.vector) {
|
|
||||||
var i = 1;
|
forindex ( var i; active_messages.vector ) {
|
||||||
var x = getprop("/ECAM/msg/line" ~ i);
|
var line = 1;
|
||||||
print("Variable i is:" ~ i);
|
if (getprop("/ECAM/msg/line" ~ line) == "") {
|
||||||
if (x == "") {
|
setprop("/ECAM/msg/line" ~ line, active_messages.vector[i]);
|
||||||
setprop("/ECAM/msg/line" ~ i, ewd_messages);
|
|
||||||
} else {
|
} else {
|
||||||
i = i + 1;
|
setprop("/ECAM/msg/line" ~ (line + 1), active_messages.vector[i]);
|
||||||
setprop("/ECAM/msg/line" ~ i, ewd_messages);
|
|
||||||
print("Variable i is:" ~ i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# debug
|
if (active_messages.size() == 0) {
|
||||||
|
setprop("/ECAM/msg/line1", "");
|
||||||
foreach(var debug; active_messages.vector) {
|
setprop("/ECAM/msg/line2", "");
|
||||||
print(debug);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,7 +80,7 @@ var ECAM = {
|
||||||
setprop("/ECAM/ldg-memo-enable", 0);
|
setprop("/ECAM/ldg-memo-enable", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size(ecam.active_messages) > 0) {
|
if (ecam.active_messages.size() > 0) {
|
||||||
setprop("/ECAM/left-msg", "MSG");
|
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) {
|
} 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");
|
setprop("/ECAM/left-msg", "TO-MEMO");
|
||||||
|
|
Reference in a new issue