diff options
author | rubidium <rubidium@openttd.org> | 2008-04-14 19:54:33 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-04-14 19:54:33 +0000 |
commit | 12188e7a5dde4cdd4304b3e738b7905e55f3ad9a (patch) | |
tree | a38226d767be0babf008f3304e7a61a4a00af2aa /src/genworld.cpp | |
parent | a8008db23daf504af9f313ff0c53c5b89e756e05 (diff) | |
download | openttd-12188e7a5dde4cdd4304b3e738b7905e55f3ad9a.tar.xz |
(svn r12706) -Merge: the thread rewrite from NoAI. The rewrite makes the threading we have better extendable.
Diffstat (limited to 'src/genworld.cpp')
-rw-r--r-- | src/genworld.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/genworld.cpp b/src/genworld.cpp index 885e5171e..ca6b89d71 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -84,7 +84,7 @@ bool IsGenerateWorldThreaded() /** * The internal, real, generate function. */ -static void *_GenerateWorld(void *arg) +static void * CDECL _GenerateWorld(void *arg) { _generating_world = true; if (_network_dedicated) DEBUG(net, 0, "Generating map, please wait..."); @@ -194,7 +194,7 @@ void WaitTillGeneratedWorld() { if (_gw.thread == NULL) return; _gw.quit_thread = true; - OTTDJoinThread((OTTDThread*)_gw.thread); + _gw.thread->Join(); _gw.thread = NULL; _gw.threaded = false; } @@ -228,6 +228,8 @@ void HandleGeneratingWorldAbortion() if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE); /* Show all vital windows again, because we have hidden them */ if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows(); + + ThreadObject *thread = _gw.thread; _gw.active = false; _gw.thread = NULL; _gw.proc = NULL; @@ -237,7 +239,7 @@ void HandleGeneratingWorldAbortion() DeleteWindowById(WC_GENERATE_PROGRESS_WINDOW, 0); MarkWholeScreenDirty(); - OTTDExitThread(); + thread->Exit(); } /** @@ -282,7 +284,7 @@ void GenerateWorld(int mode, uint size_x, uint size_y) SetupColorsAndInitialWindow(); if (_network_dedicated || - (_gw.thread = OTTDCreateThread(&_GenerateWorld, NULL)) == NULL) { + (_gw.thread = ThreadObject::New(&_GenerateWorld, NULL)) == NULL) { DEBUG(misc, 1, "Cannot create genworld thread, reverting to single-threaded mode"); _gw.threaded = false; _GenerateWorld(NULL); |