src/ai/squirrel/squirrel.cpp
branchnoai
changeset 9387 4255a0a2d272
parent 9386 c8aa2ae117f5
child 9393 04bd925b9069
--- a/src/ai/squirrel/squirrel.cpp	Wed Mar 14 12:42:37 2007 +0000
+++ b/src/ai/squirrel/squirrel.cpp	Wed Mar 14 20:22:07 2007 +0000
@@ -8,6 +8,14 @@
 #include <stdarg.h>
 #include "../../debug.h"
 
+#define SQUIRREL_CLASS
+#include "convert.hpp"
+#include "squirrel_class.hpp"
+#include "../core/ai_base.hpp"
+#include "../core/ai_company.hpp"
+#include "../core/ai_map.hpp"
+#include "../core/ai_town.hpp"
+
 /**
  * Here we handle errors that come from squirrel.
  */
@@ -63,16 +71,16 @@
 
 SQInteger Squirrel::SQGetTick(HSQUIRRELVM vm)
 {
-	Squirrel *self;
+	SQUserPointer ptr;
 
 	/* Find the 'self' pointer */
-	if (SQ_FAILED(sq_getinstanceup(vm, 1, (SQUserPointer *)&self, 0))) {
+	if (SQ_FAILED(sq_getinstanceup(vm, 1, &ptr, 0))) {
 		DEBUG(ai, 0, "[squirrel] Failed to find the instance-pointer");
 		return SQ_ERROR;
 	}
 
 	/* Return the value */
-	sq_pushinteger(vm, self->GetTick());
+	sq_pushinteger(vm, ((Squirrel *)ptr)->GetTick());
 	return 1;
 }
 
@@ -174,6 +182,11 @@
 	sq_pushroottable(this->vm);
 	this->SQAddMethod("RegisterAI", &Squirrel::SQRegisterAI, 2, "ts");
 
+	SQAIBaseRegister(this->vm);
+	SQAICompanyRegister(this->vm);
+	SQAIMapRegister(this->vm);
+	SQAITownRegister(this->vm);
+
 	/* Reset top */
 	sq_settop(this->vm, top);
 }