diff options
author | Patric Stout <truebrain@openttd.org> | 2021-03-09 14:53:51 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-03-10 13:41:18 +0100 |
commit | 970fedd78cef3f5ef7a26fcaf4fd9db0f6abbe4b (patch) | |
tree | b894a4b222a74f9d8e80832e36bd21d9a16f4f9e /src/landscape.cpp | |
parent | 098d5b22395e123e4990b73a2ad7bf703adf068b (diff) | |
download | openttd-970fedd78cef3f5ef7a26fcaf4fd9db0f6abbe4b.tar.xz |
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.
Diffstat (limited to 'src/landscape.cpp')
-rw-r--r-- | src/landscape.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp index 80ba516ac..ab6ba59f0 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -1062,6 +1062,7 @@ static bool MakeLake(TileIndex tile, void *user_data) TileIndex t2 = tile + TileOffsByDiagDir(d); if (IsWaterTile(t2)) { MakeRiver(tile, Random()); + MarkTileDirtyByTile(tile); /* Remove desert directly around the river tile. */ TileIndex t = tile; CircularTileSearch(&t, RIVER_OFFSET_DESERT_DISTANCE, RiverModifyDesertZone, nullptr); @@ -1135,6 +1136,7 @@ static void River_FoundEndNode(AyStar *aystar, OpenListNode *current) TileIndex tile = path->node.tile; if (!IsWaterTile(tile)) { MakeRiver(tile, Random()); + MarkTileDirtyByTile(tile); /* Remove desert directly around the river tile. */ CircularTileSearch(&tile, RIVER_OFFSET_DESERT_DISTANCE, RiverModifyDesertZone, nullptr); } @@ -1247,6 +1249,7 @@ static bool FlowRiver(TileIndex spring, TileIndex begin) DistanceManhattan(spring, lakeCenter) > _settings_game.game_creation.min_river_length) { end = lakeCenter; MakeRiver(lakeCenter, Random()); + MarkTileDirtyByTile(lakeCenter); /* Remove desert directly around the river tile. */ CircularTileSearch(&lakeCenter, RIVER_OFFSET_DESERT_DISTANCE, RiverModifyDesertZone, nullptr); lakeCenter = end; @@ -1368,8 +1371,11 @@ void GenerateLandscape(byte mode) /* Do not call IncreaseGeneratingWorldProgress() before FixSlopes(), * it allows screen redraw. Drawing of broken slopes crashes the game */ FixSlopes(); + MarkWholeScreenDirty(); IncreaseGeneratingWorldProgress(GWP_LANDSCAPE); + ConvertGroundTilesIntoWaterTiles(); + MarkWholeScreenDirty(); IncreaseGeneratingWorldProgress(GWP_LANDSCAPE); if (_settings_game.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest(); |