1
0
Fork 0

Accept parameter for save file

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2020-02-29 18:11:57 +00:00
parent f66013f0b1
commit c16c0c2875
2 changed files with 4 additions and 5 deletions

View file

@ -190,13 +190,13 @@ setlistener("/sim/signals/fdm-initialized", func {
writeSettings();
if (getprop("options/system/save-state") == 1)
{
save.restore();
save.restore(getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
}
spinning.stop();
});
setlistener("/sim/signals/exit", func {
save.save();
save.save(getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
});
var renderingSettings = {

View file

@ -24,9 +24,8 @@ var saved_props = [
"/consumables/fuel/tank[3]/level-lbs",
"/consumables/fuel/tank[4]/level-lbs"
];
var file = getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml";
var save = func {
var save = func (file) {
print("Saving state...");
for (var i = 0; i < size(saved_props); i += 1)
{
@ -39,7 +38,7 @@ var save = func {
print("State saved");
}
var restore = func {
var restore = func (file) {
print("Loading saved state...");
var readNode = props.globals.initNode("/save", );