summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-10 19:34:53 +0200
committerGitHub <noreply@github.com>2021-06-10 19:34:53 +0200
commit37ae6b8ae3762ddccdeb96a178b2634791e2bbe0 (patch)
treec6769135f82efdd08905671f76b2033cff1ee8b9 /src
parent174952440a1e0440ed61ca8cdbc9fa36cf66d757 (diff)
downloadopenttd-37ae6b8ae3762ddccdeb96a178b2634791e2bbe0.tar.xz
Add: adhere the autosave_on_exit setting for Null videodriver (#9343)
This is especially useful for automated-testing, to make a save when the game quits while using "-vnull:ticks=N".
Diffstat (limited to 'src')
-rw-r--r--src/video/null_v.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp
index 4f7843b75..e4f4ecf47 100644
--- a/src/video/null_v.cpp
+++ b/src/video/null_v.cpp
@@ -10,6 +10,7 @@
#include "../stdafx.h"
#include "../gfx_func.h"
#include "../blitter/factory.hpp"
+#include "../saveload/saveload.h"
#include "../window_func.h"
#include "null_v.h"
@@ -52,6 +53,12 @@ void VideoDriver_Null::MainLoop()
::InputLoop();
::UpdateWindows();
}
+
+ /* If requested, make a save just before exit. The normal exit-flow is
+ * not triggered from this driver, so we have to do this manually. */
+ if (_settings_client.gui.autosave_on_exit) {
+ DoExitSave();
+ }
}
bool VideoDriver_Null::ChangeResolution(int w, int h) { return false; }