author | truebrain |
Wed, 26 Mar 2008 15:17:40 +0000 | |
branch | noai |
changeset 9823 | 0b7f816cf46f |
parent 9746 | e4ab7ea8d897 |
child 10212 | 1e0a2a182253 |
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 { |
9745
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
23 |
/* Allow AIVehicleList_Station to be used as Squirrel parameter */ |
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
24 |
template <> AIVehicleList_Station *GetParam(ForceType<AIVehicleList_Station *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIVehicleList_Station *)instance; } |
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
25 |
template <> AIVehicleList_Station &GetParam(ForceType<AIVehicleList_Station &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_Station *)instance; } |
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
26 |
template <> const AIVehicleList_Station *GetParam(ForceType<const AIVehicleList_Station *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIVehicleList_Station *)instance; } |
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
27 |
template <> const AIVehicleList_Station &GetParam(ForceType<const AIVehicleList_Station &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_Station *)instance; } |
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
28 |
template <> int Return<AIVehicleList_Station *>(HSQUIRRELVM vm, AIVehicleList_Station *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleList_Station", res, NULL, DefSQDestructorCallback<AIVehicleList_Station>); 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 |
|
9745
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
31 |
void SQAIVehicleList_Station_Register(Squirrel *engine) { |
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
32 |
DefSQClass <AIVehicleList_Station> SQAIVehicleList_Station("AIVehicleList_Station"); |
9746
e4ab7ea8d897
(svn r12226) [NoAI] -Fix: remove the dep for AIStationList_Vehicle on AIStationList, as Squirrel doesn't like it
truebrain
parents:
9745
diff
changeset
|
33 |
SQAIVehicleList_Station.PreRegister(engine, "AIAbstractList"); |
9745
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
34 |
SQAIVehicleList_Station.AddConstructor<void (AIVehicleList_Station::*)(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 |
|
9745
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
36 |
SQAIVehicleList_Station.DefSQStaticMethod(engine, &AIVehicleList_Station::GetClassName, "GetClassName", 1, "x"); |
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
37 |
|
9745
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9741
diff
changeset
|
38 |
SQAIVehicleList_Station.PostRegister(engine); |
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9635
diff
changeset
|
39 |
} |