| author | truebrain |
| Sat, 23 Feb 2008 14:49:31 +0000 | |
| branch | noai |
| changeset 9743 | 4c44aa6a8f43 |
| parent 9741 | 53c1c5850e01 |
| child 9745 | fb2454d70f37 |
| permissions | -rw-r--r-- |
|
9614
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
1 |
#include "ai_vehiclelist.hpp" |
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
2 |
|
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
3 |
namespace SQConvert {
|
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
4 |
/* Allow AIVehicleList to be used as Squirrel parameter */ |
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
5 |
template <> AIVehicleList *GetParam(ForceType<AIVehicleList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIVehicleList *)instance; }
|
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
6 |
template <> AIVehicleList &GetParam(ForceType<AIVehicleList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList *)instance; }
|
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
7 |
template <> const AIVehicleList *GetParam(ForceType<const AIVehicleList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIVehicleList *)instance; }
|
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
8 |
template <> const AIVehicleList &GetParam(ForceType<const AIVehicleList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList *)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<AIVehicleList *>(HSQUIRRELVM vm, AIVehicleList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleList", res, NULL, DefSQDestructorCallback<AIVehicleList>); return 1; }
|
|
9614
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
10 |
}; // namespace SQConvert |
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
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:
9740
diff
changeset
|
12 |
void SQAIVehicleList_Register(Squirrel *engine) {
|
|
9614
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
13 |
DefSQClass <AIVehicleList> SQAIVehicleList("AIVehicleList");
|
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
14 |
SQAIVehicleList.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:
9614
diff
changeset
|
15 |
SQAIVehicleList.AddConstructor<void (AIVehicleList::*)(), 1>(engine, "x"); |
|
9614
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
16 |
|
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
17 |
SQAIVehicleList.DefSQStaticMethod(engine, &AIVehicleList::GetClassName, "GetClassName", 1, "x"); |
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
18 |
|
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
19 |
SQAIVehicleList.PostRegister(engine); |
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
20 |
} |
|
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
21 |
|
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
22 |
namespace SQConvert {
|
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
23 |
/* Allow AIStationVehicleList to be used as Squirrel parameter */ |
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
24 |
template <> AIStationVehicleList *GetParam(ForceType<AIStationVehicleList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIStationVehicleList *)instance; }
|
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
25 |
template <> AIStationVehicleList &GetParam(ForceType<AIStationVehicleList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationVehicleList *)instance; }
|
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
26 |
template <> const AIStationVehicleList *GetParam(ForceType<const AIStationVehicleList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIStationVehicleList *)instance; }
|
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
27 |
template <> const AIStationVehicleList &GetParam(ForceType<const AIStationVehicleList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationVehicleList *)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
|
28 |
template <> int Return<AIStationVehicleList *>(HSQUIRRELVM vm, AIStationVehicleList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIStationVehicleList", res, NULL, DefSQDestructorCallback<AIStationVehicleList>); return 1; }
|
|
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
29 |
}; // namespace SQConvert |
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
30 |
|
|
9741
53c1c5850e01
(svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
truebrain
parents:
9740
diff
changeset
|
31 |
void SQAIStationVehicleList_Register(Squirrel *engine) {
|
|
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
32 |
DefSQClass <AIStationVehicleList> SQAIStationVehicleList("AIStationVehicleList");
|
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
33 |
SQAIStationVehicleList.PreRegister(engine, "AIAbstractList"); |
|
9740
a98f20bce404
(svn r12220) [NoAI] -Fix: minor type in AIVehicleStation, and missing security check
truebrain
parents:
9680
diff
changeset
|
34 |
SQAIStationVehicleList.AddConstructor<void (AIStationVehicleList::*)(StationID station_id), 2>(engine, "xi"); |
|
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
35 |
|
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
36 |
SQAIStationVehicleList.DefSQStaticMethod(engine, &AIStationVehicleList::GetClassName, "GetClassName", 1, "x"); |
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
37 |
|
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
38 |
SQAIStationVehicleList.PostRegister(engine); |
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
39 |
} |