From 0a7a4e06ad4c7635c149c924a7d52c7066d0c982 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 10 Jun 2021 19:34:53 +0200 Subject: [PATCH] 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". (cherry picked from commit 37ae6b8ae3762ddccdeb96a178b2634791e2bbe0) --- src/video/null_v.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp index 78b660258f..754b3c0ef0 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 "../thread.h" #include "null_v.h" @@ -63,6 +64,12 @@ void VideoDriver_Null::MainLoop() ::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; }