summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 37f9a3d34..4df12e210 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -19,6 +19,7 @@
#include "landscape_type.h"
#include "network/network_func.h"
#include "core/smallvec_type.hpp"
+#include "thread.h"
#include "table/palettes.h"
#include "table/sprites.h"
@@ -1275,7 +1276,18 @@ void DrawDirtyBlocks()
int x;
int y;
- if (IsGeneratingWorld() && !IsGeneratingWorldReadyForPaint()) return;
+ if (IsGeneratingWorld()) {
+ /* We are generating the world, so release our rights to the map and
+ * painting while we are waiting a bit. */
+ _genworld_paint_mutex->EndCritical();
+ _genworld_mapgen_mutex->EndCritical();
+
+ /* Wait a while and update _realtime_tick so we are given the rights */
+ CSleep(GENWORLD_REDRAW_TIMEOUT);
+ _realtime_tick += GENWORLD_REDRAW_TIMEOUT;
+ _genworld_paint_mutex->BeginCritical();
+ _genworld_mapgen_mutex->BeginCritical();
+ }
y = 0;
do {
@@ -1343,12 +1355,6 @@ void DrawDirtyBlocks()
_invalid_rect.top = h;
_invalid_rect.right = 0;
_invalid_rect.bottom = 0;
-
- /* If we are generating a world, and waiting for a paint run, mark it here
- * as done painting, so we can continue generating. */
- if (IsGeneratingWorld() && IsGeneratingWorldReadyForPaint()) {
- SetGeneratingWorldPaintStatus(false);
- }
}
/*!