summaryrefslogtreecommitdiff
path: root/src/video/win32_v.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-02-18 13:33:27 +0100
committerPatric Stout <github@truebrain.nl>2021-02-19 10:43:15 +0100
commitc4df0f95ae106f3e41c8c1fb5c19670ce876f1f4 (patch)
tree84ca8c35b7378ae4efee4b069736902beb746c83 /src/video/win32_v.cpp
parentfa170b9ace1a2f45833627676b0106ee13914bd4 (diff)
downloadopenttd-c4df0f95ae106f3e41c8c1fb5c19670ce876f1f4.tar.xz
Fix: during switching of game-mode, drawing could show closed windows that shouldn't be closed yet
The higher your refresh-rate, the more likely this is. Mostly you notice this when creating a new game or when abandoning a game. This is a bit of a hack to keep the old behaviour, as before this patch the game was already freezing your mouse while it was changing game-mode, and it does this too after this patch. Just now it freezes too a few frames earlier, to prevent not drawing windows people still expect to see.
Diffstat (limited to 'src/video/win32_v.cpp')
-rw-r--r--src/video/win32_v.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index a15071178..4ffbc9a21 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -1225,7 +1225,8 @@ void VideoDriver_Win32::MainLoop()
if (_draw_threaded) draw_lock.lock();
}
- if (cur_ticks >= next_draw_tick) {
+ /* Prevent drawing when switching mode, as windows can be removed when they should still appear. */
+ if (cur_ticks >= next_draw_tick && (_switch_mode == SM_NONE || HasModalProgress())) {
next_draw_tick += this->GetDrawInterval();
/* Avoid next_draw_tick getting behind more and more if it cannot keep up. */
if (next_draw_tick < cur_ticks - ALLOWED_DRIFT * this->GetDrawInterval()) next_draw_tick = cur_ticks;