(svn r9264) [NoAI] -Codechange: function AI_ThreadRun() is not static method of AIThreadState (should make porting to win32 bit easier) noai
authorKUDr
Sat, 17 Mar 2007 10:46:56 +0000
branchnoai
changeset 9445 2a4a87b968e2
parent 9444 fd27df7ca2a0
child 9446 91abf9a13d74
(svn r9264) [NoAI] -Codechange: function AI_ThreadRun() is not static method of AIThreadState (should make porting to win32 bit easier)
src/ai/ai_threads.cpp
--- 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