1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 04:29:09 +00:00

Add: make modal windows update more smooth

Basically, modal windows had their own thread-locking for what
drawing was possible. This is a bit nonsense now we have a
game-thread. And it makes much more sense to do things like
NewGRFScan and GenerateWorld in the game-thread, and not in a
thread next to the game-thread.

This commit changes that: it removes the threads for NewGRFScan
and GenerateWorld, and just runs the code in the game-thread.
On regular intervals it allows the draw-thread to do a tick,
which gives a much smoother look and feel.

It does slow down NewGRFScan and GenerateWorld ever so slightly
as it spends more time on drawing. But the slowdown is not
measureable on my machines (with 700+ NewGRFs / 4kx4k map and
a Debug build).

Running without a game-thread means NewGRFScan and GenerateWorld
are now blocking.
This commit is contained in:
Patric Stout
2021-03-09 14:53:51 +01:00
committed by Patric Stout
parent 098d5b2239
commit 970fedd78c
19 changed files with 89 additions and 209 deletions

View File

@@ -15,6 +15,7 @@
#include "../ai/ai.hpp"
#include "../game/game.hpp"
#include "../base_media_base.h"
#include "../openttd.h"
#include "../sortlist_type.h"
#include "../stringfilter_type.h"
#include "../querystring_gui.h"
@@ -236,7 +237,7 @@ public:
break;
case CONTENT_TYPE_NEWGRF:
ScanNewGRFFiles(nullptr);
RequestNewGRFScan();
break;
case CONTENT_TYPE_SCENARIO: