Implementing state save between sessions
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
d47b3431d2
commit
5638ad8377
3 changed files with 35 additions and 0 deletions
|
@ -1949,6 +1949,9 @@
|
|||
<file>Aircraft/A320-family/gui/dialogs/refuel.nas</file>
|
||||
<file>Aircraft/A320-family/gui/dialogs/rmp.nas</file>
|
||||
</Dialogs>
|
||||
<save>
|
||||
<file>Aircraft/A320-family/Nasal/Systems/save.nas</file>
|
||||
</save>
|
||||
</nasal>
|
||||
|
||||
</PropertyList>
|
||||
|
|
|
@ -96,6 +96,7 @@ setprop("systems/acconfig/options/weight-kgs", 0);
|
|||
setprop("systems/acconfig/options/adirs-skip", 0);
|
||||
setprop("systems/acconfig/options/welcome-skip", 0);
|
||||
setprop("systems/acconfig/options/no-rendering-warn", 0);
|
||||
setprop("systems/acconfig/options/save-state", 0);
|
||||
setprop("systems/acconfig/options/pfd-rate", 1);
|
||||
setprop("systems/acconfig/options/nd-rate", 1);
|
||||
setprop("systems/acconfig/options/uecam-rate", 1);
|
||||
|
@ -187,9 +188,17 @@ setlistener("/sim/signals/fdm-initialized", func {
|
|||
}
|
||||
setprop("systems/acconfig/options/revision", current_revision);
|
||||
writeSettings();
|
||||
if (getprop("options/system/save-state") == 1)
|
||||
{
|
||||
save.restore();
|
||||
}
|
||||
spinning.stop();
|
||||
});
|
||||
|
||||
setlistener("/sim/signals/exit", func {
|
||||
save.save();
|
||||
});
|
||||
|
||||
var renderingSettings = {
|
||||
check: func() {
|
||||
var rembrandt = getprop("sim/rendering/rembrandt/enabled");
|
||||
|
@ -223,6 +232,7 @@ var readSettings = func {
|
|||
io.read_properties(getprop("sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
|
||||
setprop("options/system/keyboard-mode", getprop("systems/acconfig/options/keyboard-mode"));
|
||||
setprop("options/system/weight-kgs", getprop("systems/acconfig/options/weight-kgs"));
|
||||
setprop("options/system/save-state", getprop("systems/acconfig/options/save-state"));
|
||||
setprop("controls/adirs/skip", getprop("systems/acconfig/options/adirs-skip"));
|
||||
setprop("sim/model/autopush/route/show", getprop("systems/acconfig/options/autopush/show-route"));
|
||||
setprop("sim/model/autopush/route/show-wingtip", getprop("systems/acconfig/options/autopush/show-wingtip"));
|
||||
|
@ -232,6 +242,7 @@ var readSettings = func {
|
|||
var writeSettings = func {
|
||||
setprop("systems/acconfig/options/keyboard-mode", getprop("options/system/keyboard-mode"));
|
||||
setprop("systems/acconfig/options/weight-kgs", getprop("options/system/weight-kgs"));
|
||||
setprop("systems/acconfig/options/save-state", getprop("options/system/save-state"));
|
||||
setprop("systems/acconfig/options/adirs-skip", getprop("controls/adirs/skip"));
|
||||
setprop("systems/acconfig/options/autopush/show-route", getprop("sim/model/autopush/route/show"));
|
||||
setprop("systems/acconfig/options/autopush/show-wingtip", getprop("sim/model/autopush/route/show-wingtip"));
|
||||
|
|
|
@ -426,6 +426,27 @@
|
|||
</binding>
|
||||
<live>true</live>
|
||||
</checkbox>
|
||||
|
||||
<checkbox>
|
||||
<!-- TODO there might be a better way to formulate this. -->
|
||||
<label>Save states between sessions</label>
|
||||
<halign>left</halign>
|
||||
<property>/systems/acconfig/options/save-state</property>
|
||||
<binding>
|
||||
<command>property-toggle</command>
|
||||
<property>/options/system/save-state</property>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
acconfig.writeSettings();
|
||||
</script>
|
||||
</binding>
|
||||
<live>true</live>
|
||||
</checkbox>
|
||||
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
|
|
Loading…
Add table
Reference in a new issue