--- a/src/genworld.cpp Mon Apr 14 17:50:15 2008 +0000
+++ b/src/genworld.cpp Mon Apr 14 19:54:33 2008 +0000
@@ -84,7 +84,7 @@
/**
* 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 @@
{
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 @@
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 @@
DeleteWindowById(WC_GENERATE_PROGRESS_WINDOW, 0);
MarkWholeScreenDirty();
- OTTDExitThread();
+ thread->Exit();
}
/**
@@ -282,7 +284,7 @@
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);