author | truebrain |
Wed, 26 Mar 2008 15:17:40 +0000 | |
branch | noai |
changeset 9823 | 0b7f816cf46f |
parent 9749 | ee414c031e73 |
child 10212 | 1e0a2a182253 |
permissions | -rw-r--r-- |
9596
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
1 |
#include "ai_settings.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 AISettings 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 <> AISettings *GetParam(ForceType<AISettings *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISettings *)instance; } |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
6 |
template <> AISettings &GetParam(ForceType<AISettings &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISettings *)instance; } |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
7 |
template <> const AISettings *GetParam(ForceType<const AISettings *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISettings *)instance; } |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
8 |
template <> const AISettings &GetParam(ForceType<const AISettings &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISettings *)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<AISettings *>(HSQUIRRELVM vm, AISettings *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISettings", res, NULL, DefSQDestructorCallback<AISettings>); 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 |
|
9741
53c1c5850e01
(svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
truebrain
parents:
9680
diff
changeset
|
12 |
void SQAISettings_Register(Squirrel *engine) { |
9596
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
13 |
DefSQClass <AISettings> SQAISettings("AISettings"); |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
14 |
SQAISettings.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 |
SQAISettings.AddConstructor<void (AISettings::*)(), 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 |
|
9749
ee414c031e73
(svn r12229) [NoAI] -Fix: AISetting()s functions can be static too
truebrain
parents:
9741
diff
changeset
|
17 |
SQAISettings.DefSQStaticMethod(engine, &AISettings::GetClassName, "GetClassName", 1, "x"); |
ee414c031e73
(svn r12229) [NoAI] -Fix: AISetting()s functions can be static too
truebrain
parents:
9741
diff
changeset
|
18 |
SQAISettings.DefSQStaticMethod(engine, &AISettings::SetCommandDelay, "SetCommandDelay", 2, "xi"); |
9596
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 |
SQAISettings.PostRegister(engine); |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
21 |
} |