summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-03 15:44:05 +0000
committerrubidium <rubidium@openttd.org>2009-05-03 15:44:05 +0000
commitd685ca0619cdbaf61623b673d26a2c9aa8b5b85e (patch)
treefa050ce2c3ba55aadcc588d3e60293e710e6b886 /src/openttd.cpp
parentc29f4fd738f65678356718b8487cf18e196a2dec (diff)
downloadopenttd-d685ca0619cdbaf61623b673d26a2c9aa8b5b85e.tar.xz
(svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 800b791ab..9dac52fe9 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -50,6 +50,7 @@
#include "elrail_func.h"
#include "rev.h"
#include "highscore.h"
+#include "thread.h"
#include "newgrf_commons.h"
@@ -655,6 +656,10 @@ int ttd_main(int argc, char *argv[])
InitializeGUI();
IConsoleCmdExec("exec scripts/autoexec.scr 0");
+ /* Take our initial lock on whatever we might want to do! */
+ _genworld_paint_mutex->BeginCritical();
+ _genworld_mapgen_mutex->BeginCritical();
+
GenerateWorld(GW_EMPTY, 64, 64); // Make the viewport initialization happy
WaitTillGeneratedWorld();