src/ai/api/ai_sign.hpp.sq
author truelight
Sun, 19 Aug 2007 13:16:06 +0000
branchnoai
changeset 9696 4384ed3de1f0
parent 9680 5ed7bbfd51c7
child 9737 ee408edf3851
permissions -rw-r--r--
(svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
[NoAI] -Fix: AICompant::GetCompanyName returned \0 for invalid company instead of NULL
9596
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     1
#include "ai_sign.hpp"
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     2
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     3
namespace SQConvert {
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     4
	/* Allow AISign to be used as Squirrel parameter */
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     5
	template <> AISign *GetParam(ForceType<AISign *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISign *)instance; }
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     6
	template <> AISign &GetParam(ForceType<AISign &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISign *)instance; }
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     7
	template <> const AISign *GetParam(ForceType<const AISign *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISign *)instance; }
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     8
	template <> const AISign &GetParam(ForceType<const AISign &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISign *)instance; }
9680
5ed7bbfd51c7 (svn r10629) [NoAI] -Fix: on returning a class instance which is NULL, do not make a wrapper SQ, but return a NULL pointer too
truelight
parents: 9679
diff changeset
     9
	template <> int Return<AISign *>(HSQUIRRELVM vm, AISign *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISign", res, NULL, DefSQDestructorCallback<AISign>); return 1; }
9596
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    10
}; // namespace SQConvert
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    11
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    12
void SQAISignRegister(Squirrel *engine) {
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    13
	DefSQClass <AISign> SQAISign("AISign");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    14
	SQAISign.PreRegister(engine);
9635
9ee82e091af7 (svn r10526) [NoAI] -Fix: a class with params for the constructor lost his instance when called from SQ (templates can be really useful ;))
truelight
parents: 9610
diff changeset
    15
	SQAISign.AddConstructor<void (AISign::*)(), 1>(engine, "x");
9596
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    16
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    17
	SQAISign.DefSQStaticMethod(engine, &AISign::GetClassName, "GetClassName", 1, "x");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    18
	SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign,  "IsValidSign",  2, "xi");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    19
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    20
	SQAISign.DefSQMethod(engine, &AISign::GetMaxSignID, "GetMaxSignID", 1, "x");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    21
	SQAISign.DefSQMethod(engine, &AISign::GetSignCount, "GetSignCount", 1, "x");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    22
	SQAISign.DefSQMethod(engine, &AISign::GetText,      "GetText",      2, "xi");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    23
	SQAISign.DefSQMethod(engine, &AISign::GetLocation,  "GetLocation",  2, "xi");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    24
	SQAISign.DefSQMethod(engine, &AISign::RemoveSign,   "RemoveSign",   2, "xi");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    25
	SQAISign.DefSQMethod(engine, &AISign::BuildSign,    "BuildSign",    3, "xis");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    26
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    27
	SQAISign.PostRegister(engine);
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    28
}