(svn r9264) [NoAI] -Codechange: function AI_ThreadRun() is not static method of AIThreadState (should make porting to win32 bit easier)
--- a/src/ai/ai_threads.cpp Fri Mar 16 22:00:07 2007 +0000
+++ b/src/ai/ai_threads.cpp Sat Mar 17 10:46:56 2007 +0000
@@ -14,12 +14,6 @@
#include <pthread.h>
-/**
- * Function that is started as process of the new thread.
- * @param arg some random argument, in this case a AIThreadState
- */
-static void *AI_ThreadRun(void *arg);
-
/** The overall state of an AI threading wise */
class AIThreadState {
/** Different states of the AI thread */
@@ -82,7 +76,7 @@
pthread_mutex_lock(&this->mutex);
this->state = STARTING;
- this->thread = OTTDCreateThread(AI_ThreadRun, this);
+ this->thread = OTTDCreateThread(&AIThreadState::stThreadRun, this);
/* XXX -- We should handle this more nicely */
assert(this->thread != NULL);
@@ -92,6 +86,16 @@
}
/**
+ * Function that is started as process of the new thread.
+ * @param arg some random argument, in this case a AIThreadState
+ */
+ static void *stThreadRun(void *arg)
+ {
+ ((AIThreadState*)arg)->ThreadRun();
+ return NULL;
+ }
+
+ /**
* The method that runs in the new Thread.
* @note should be called by the newly spawned thread in Start.
*/
@@ -201,12 +205,6 @@
static AIThreadState _ai_state[MAX_PLAYERS];
-static void *AI_ThreadRun(void *arg)
-{
- ((AIThreadState*)arg)->ThreadRun();
- return NULL;
-}
-
/**
* Suspend the AI handler of a player.
* @param player the player to suspend for