1
0
Fork 0

Persistent across sessions

This commit is contained in:
legoboyvdlp R 2020-05-19 13:04:33 +01:00
parent cfcb77e3cf
commit bd55b7a504
3 changed files with 13 additions and 3 deletions

View file

@ -811,9 +811,11 @@ var canvas_MCDU_base = {
if (fmgc.WaypointDatabase.confirm) {
me["Simple_R5"].setText("CONFIRM DELETE ALL ");
me["Simple_R5"].setColor(getprop("/MCDUC/colors/amb/r"),getprop("/MCDUC/colors/amb/g"),getprop("/MCDUC/colors/amb/b"));
me["arrow5R"].setColor(getprop("/MCDUC/colors/amb/r"),getprop("/MCDUC/colors/amb/g"),getprop("/MCDUC/colors/amb/b"));
} else {
me["Simple_R5"].setText("DELETE ALL ");
me["Simple_R5"].setColor(getprop("/MCDUC/colors/blu/r"),getprop("/MCDUC/colors/blu/g"),getprop("/MCDUC/colors/blu/b"));
me["arrow5R"].setColor(getprop("/MCDUC/colors/blu/r"),getprop("/MCDUC/colors/blu/g"),getprop("/MCDUC/colors/blu/b"));
}
if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 7) {

View file

@ -30,19 +30,21 @@ var WaypointDatabase = {
if (wpObj.index >= me.getSize()) {
# add to end, since index doesn't exist
append(me.waypointsVec, wpObj);
me.write();
return 2;
} elsif (me.waypointsVec[wpObj.index] == nil) {
# add at passed index
me.waypointsVec[wpObj.index] = wpObj;
me.write();
return 2;
} else {
# fall back to end
logprint(4, "pilotWaypoint constructor claims index " ~ wpObj.index ~ " is nil, but it isn't!");
append(me.waypointsVec, wpObj);
me.write();
return 2;
}
me.write();
},
# delete - empties waypoints vector
delete: func() {
@ -54,6 +56,7 @@ var WaypointDatabase = {
}
}
}
me.write();
},
# deleteAtIndex - delete at specific index. Set to nil, so it still exists in vector
deleteAtIndex: func(index) {
@ -61,6 +64,7 @@ var WaypointDatabase = {
return;
}
me.waypointsVec[index] = nil;
me.write();
},
# getNilIndex - find the first nil
# post 2020.1 use dedicated function vecindex()
@ -118,8 +122,12 @@ var WaypointDatabase = {
},
# read - read from a file, extract using props interface
read: func() {
me.delete();
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml";
# create file if it doesn't exist
if (io.stat(path) == nil) {
me.write();
return;
}
var data = io.readxml(path).getChild("waypoints");
var pilotWP = nil;
for (var i = 0; i < 20; i = i + 1) {

View file

@ -7,7 +7,7 @@
<channel name="Fuel Pumps and Valves">
<!-- Pumps -->
<switch name="/systems/fuel/pumps/apu-operate">
<switch name="/systems/fuel/pumps/apu-operate"> <!-- DC HOT 1 ? -->
<default value="0"/>
<test logic="AND" value="1">
/systems/fuel/pumps/all-eng-pump-off eq 1