author | rubidium |
Thu, 03 Apr 2008 23:01:54 +0000 | |
branch | noai |
changeset 9865 | f241472f09dc |
parent 9757 | 5cdc14959fb6 |
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_tilelist.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 AITileList 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 <> AITileList *GetParam(ForceType<AITileList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AITileList *)instance; } |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
6 |
template <> AITileList &GetParam(ForceType<AITileList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList *)instance; } |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
7 |
template <> const AITileList *GetParam(ForceType<const AITileList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AITileList *)instance; } |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
8 |
template <> const AITileList &GetParam(ForceType<const AITileList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList *)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<AITileList *>(HSQUIRRELVM vm, AITileList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITileList", res, NULL, DefSQDestructorCallback<AITileList>); 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 SQAITileList_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 <AITileList> SQAITileList("AITileList"); |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
14 |
SQAITileList.PreRegister(engine, "AIAbstractList"); |
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 |
SQAITileList.AddConstructor<void (AITileList::*)(), 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 |
SQAITileList.DefSQStaticMethod(engine, &AITileList::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 |
|
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
19 |
SQAITileList.DefSQMethod(engine, &AITileList::AddRectangle, "AddRectangle", 3, "xii"); |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
20 |
SQAITileList.DefSQMethod(engine, &AITileList::AddTile, "AddTile", 2, "xi"); |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
21 |
SQAITileList.DefSQMethod(engine, &AITileList::RemoveRectangle, "RemoveRectangle", 3, "xii"); |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
22 |
SQAITileList.DefSQMethod(engine, &AITileList::RemoveTile, "RemoveTile", 2, "xi"); |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
23 |
|
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
24 |
SQAITileList.PostRegister(engine); |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff
changeset
|
25 |
} |
9757
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
26 |
|
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
27 |
namespace SQConvert { |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
28 |
/* Allow AITileList_IndustryAccepting to be used as Squirrel parameter */ |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
29 |
template <> AITileList_IndustryAccepting *GetParam(ForceType<AITileList_IndustryAccepting *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AITileList_IndustryAccepting *)instance; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
30 |
template <> AITileList_IndustryAccepting &GetParam(ForceType<AITileList_IndustryAccepting &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_IndustryAccepting *)instance; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
31 |
template <> const AITileList_IndustryAccepting *GetParam(ForceType<const AITileList_IndustryAccepting *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AITileList_IndustryAccepting *)instance; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
32 |
template <> const AITileList_IndustryAccepting &GetParam(ForceType<const AITileList_IndustryAccepting &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_IndustryAccepting *)instance; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
33 |
template <> int Return<AITileList_IndustryAccepting *>(HSQUIRRELVM vm, AITileList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITileList_IndustryAccepting", res, NULL, DefSQDestructorCallback<AITileList_IndustryAccepting>); return 1; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
34 |
}; // namespace SQConvert |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
35 |
|
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
36 |
void SQAITileList_IndustryAccepting_Register(Squirrel *engine) { |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
37 |
DefSQClass <AITileList_IndustryAccepting> SQAITileList_IndustryAccepting("AITileList_IndustryAccepting"); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
38 |
SQAITileList_IndustryAccepting.PreRegister(engine, "AITileList"); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
39 |
SQAITileList_IndustryAccepting.AddConstructor<void (AITileList_IndustryAccepting::*)(IndustryID industry_id, uint radius), 3>(engine, "xii"); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
40 |
|
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
41 |
SQAITileList_IndustryAccepting.DefSQStaticMethod(engine, &AITileList_IndustryAccepting::GetClassName, "GetClassName", 1, "x"); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
42 |
|
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
43 |
SQAITileList_IndustryAccepting.PostRegister(engine); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
44 |
} |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
45 |
|
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
46 |
namespace SQConvert { |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
47 |
/* Allow AITileList_IndustryProducing to be used as Squirrel parameter */ |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
48 |
template <> AITileList_IndustryProducing *GetParam(ForceType<AITileList_IndustryProducing *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AITileList_IndustryProducing *)instance; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
49 |
template <> AITileList_IndustryProducing &GetParam(ForceType<AITileList_IndustryProducing &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_IndustryProducing *)instance; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
50 |
template <> const AITileList_IndustryProducing *GetParam(ForceType<const AITileList_IndustryProducing *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AITileList_IndustryProducing *)instance; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
51 |
template <> const AITileList_IndustryProducing &GetParam(ForceType<const AITileList_IndustryProducing &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_IndustryProducing *)instance; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
52 |
template <> int Return<AITileList_IndustryProducing *>(HSQUIRRELVM vm, AITileList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITileList_IndustryProducing", res, NULL, DefSQDestructorCallback<AITileList_IndustryProducing>); return 1; } |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
53 |
}; // namespace SQConvert |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
54 |
|
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
55 |
void SQAITileList_IndustryProducing_Register(Squirrel *engine) { |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
56 |
DefSQClass <AITileList_IndustryProducing> SQAITileList_IndustryProducing("AITileList_IndustryProducing"); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
57 |
SQAITileList_IndustryProducing.PreRegister(engine, "AITileList"); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
58 |
SQAITileList_IndustryProducing.AddConstructor<void (AITileList_IndustryProducing::*)(IndustryID industry_id, uint radius), 3>(engine, "xii"); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
59 |
|
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
60 |
SQAITileList_IndustryProducing.DefSQStaticMethod(engine, &AITileList_IndustryProducing::GetClassName, "GetClassName", 1, "x"); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
61 |
|
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
62 |
SQAITileList_IndustryProducing.PostRegister(engine); |
5cdc14959fb6
(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents:
9741
diff
changeset
|
63 |
} |