diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp index 4ee2d05ceb..a951b608bf 100644 --- a/src/video/null_v.cpp +++ b/src/video/null_v.cpp @@ -19,6 +19,8 @@ /** Factory for the null video driver. */ static FVideoDriver_Null iFVideoDriver_Null; +extern bool _exit_game; + const char *VideoDriver_Null::Start(const char * const *parm) { #ifdef _MSC_VER @@ -27,6 +29,7 @@ const char *VideoDriver_Null::Start(const char * const *parm) #endif this->ticks = GetDriverParamInt(parm, "ticks", 1000); + this->until_exit = GetDriverParamBool(parm, "until_exit"); _screen.width = _screen.pitch = _cur_resolution.width; _screen.height = _cur_resolution.height; _screen.dst_ptr = nullptr; @@ -44,11 +47,16 @@ void VideoDriver_Null::MakeDirty(int left, int top, int width, int height) {} void VideoDriver_Null::MainLoop() { - uint i; - - for (i = 0; i < this->ticks; i++) { - GameLoop(); - UpdateWindows(); + if (this->until_exit) { + while (!_exit_game) { + GameLoop(); + UpdateWindows(); + } + } else { + for (int i = 0; i < this->ticks; i++) { + GameLoop(); + UpdateWindows(); + } } } diff --git a/src/video/null_v.h b/src/video/null_v.h index a3b2cb5a81..baf482074e 100644 --- a/src/video/null_v.h +++ b/src/video/null_v.h @@ -17,7 +17,8 @@ /** The null video driver. */ class VideoDriver_Null : public VideoDriver { private: - uint ticks; ///< Amount of ticks to run. + int ticks; ///< Amount of ticks to run. + bool until_exit; public: const char *Start(const char * const *param) override;