(svn r13436) [NoAI] -Change: call the constructor of the SQ when the ->Start() is called of AIController. This makes sure the SQ code is always executed inside the thread, and not inside the main-thread. This has no change what so ever for AIs.
--- a/src/ai/api/ai_controller.cpp Mon Jun 09 14:38:23 2008 +0000
+++ b/src/ai/api/ai_controller.cpp Mon Jun 09 21:24:10 2008 +0000
@@ -170,13 +170,18 @@
this->engine = NULL;
return;
}
- if (this->engine->MethodExists(*this->SQ_instance, "constructor"))
- this->engine->CallMethod(*this->SQ_instance, "constructor");
}
void AIController::Start()
{
- if (this->engine != NULL) this->engine->CallMethod(*this->SQ_instance, "Start");
+ if (this->engine == NULL) return;
+
+ /* Run the constructor first */
+ if (this->engine->MethodExists(*this->SQ_instance, "constructor")) {
+ this->engine->CallMethod(*this->SQ_instance, "constructor");
+ }
+ /* When that is done, start the Start() function */
+ this->engine->CallMethod(*this->SQ_instance, "Start");
}
AIController::~AIController()