summaryrefslogtreecommitdiff
path: root/src/genworld.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-12-19 20:56:50 +0000
committertruebrain <truebrain@openttd.org>2011-12-19 20:56:50 +0000
commit83f2785f54de1c31267c5586464c97fb39f95b5a (patch)
treede073b47921321433fc0945bd63bc9c07d4a1f33 /src/genworld.cpp
parentcbe43abe5db481568ccf988dbe994f43a985efbd (diff)
downloadopenttd-83f2785f54de1c31267c5586464c97fb39f95b5a.tar.xz
(svn r23611) -Add: run the begin of the script already while generating, and don't sleep on DoCommand while doing so
Diffstat (limited to 'src/genworld.cpp')
-rw-r--r--src/genworld.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/genworld.cpp b/src/genworld.cpp
index f36837879..ca4f1ef6f 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -34,6 +34,7 @@
#include "progress.h"
#include "error.h"
#include "game/game.hpp"
+#include "game/game_instance.hpp"
#include "table/sprites.h"
@@ -166,6 +167,17 @@ static void _GenerateWorld(void *)
if (_game_mode != GM_EDITOR) {
Game::StartNew();
+
+ if (Game::GetInstance() != NULL) {
+ SetGeneratingWorldProgress(GWP_RUNSCRIPT, 2500);
+ _generating_world = true;
+ for (i = 0; i < 2500; i++) {
+ Game::GameLoop();
+ IncreaseGeneratingWorldProgress(GWP_RUNSCRIPT);
+ if (Game::GetInstance()->IsSleeping()) break;
+ }
+ _generating_world = false;
+ }
}
}