author | truelight |
Thu, 19 Jul 2007 19:42:54 +0000 | |
branch | noai |
changeset 9680 | 5ed7bbfd51c7 |
parent 9679 | 788e083db48b |
child 9741 | 53c1c5850e01 |
permissions | -rw-r--r-- |
9636
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
1 |
#include "ai_stationlist.hpp" |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
2 |
|
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
3 |
namespace SQConvert { |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
4 |
/* Allow AIStationList to be used as Squirrel parameter */ |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
5 |
template <> AIStationList *GetParam(ForceType<AIStationList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIStationList *)instance; } |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
6 |
template <> AIStationList &GetParam(ForceType<AIStationList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationList *)instance; } |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
7 |
template <> const AIStationList *GetParam(ForceType<const AIStationList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIStationList *)instance; } |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
8 |
template <> const AIStationList &GetParam(ForceType<const AIStationList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationList *)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<AIStationList *>(HSQUIRRELVM vm, AIStationList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIStationList", res, NULL, DefSQDestructorCallback<AIStationList>); return 1; } |
9636
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
10 |
}; // namespace SQConvert |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
11 |
|
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
12 |
void SQAIStationListRegister(Squirrel *engine) { |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
13 |
DefSQClass <AIStationList> SQAIStationList("AIStationList"); |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
14 |
SQAIStationList.PreRegister(engine, "AIAbstractList"); |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9645
diff
changeset
|
15 |
SQAIStationList.AddConstructor<void (AIStationList::*)(AIStation::StationType type), 2>(engine, "xi"); |
9636
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
16 |
|
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
17 |
SQAIStationList.DefSQStaticMethod(engine, &AIStationList::GetClassName, "GetClassName", 1, "x"); |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
18 |
|
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
19 |
SQAIStationList.PostRegister(engine); |
1005ffccf641
(svn r10527) [NoAI] -Add: AIStationList(), which lists all your stations; useful to maintain routes
truelight
parents:
diff
changeset
|
20 |
} |
9645
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
21 |
|
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
22 |
namespace SQConvert { |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
23 |
/* Allow AIVehicleStationList to be used as Squirrel parameter */ |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
24 |
template <> AIVehicleStationList *GetParam(ForceType<AIVehicleStationList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIVehicleStationList *)instance; } |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
25 |
template <> AIVehicleStationList &GetParam(ForceType<AIVehicleStationList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleStationList *)instance; } |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
26 |
template <> const AIVehicleStationList *GetParam(ForceType<const AIVehicleStationList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIVehicleStationList *)instance; } |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
27 |
template <> const AIVehicleStationList &GetParam(ForceType<const AIVehicleStationList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleStationList *)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<AIVehicleStationList *>(HSQUIRRELVM vm, AIVehicleStationList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleStationList", res, NULL, DefSQDestructorCallback<AIVehicleStationList>); return 1; } |
9645
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
29 |
}; // namespace SQConvert |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
30 |
|
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
31 |
void SQAIVehicleStationListRegister(Squirrel *engine) { |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
32 |
DefSQClass <AIVehicleStationList> SQAIVehicleStationList("AIVehicleStationList"); |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
33 |
SQAIVehicleStationList.PreRegister(engine, "AIAbstractList"); |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
34 |
SQAIVehicleStationList.AddConstructor<void (AIVehicleStationList::*)(VehicleID vehicle_id), 2>(engine, "xi"); |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
35 |
|
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
36 |
SQAIVehicleStationList.DefSQStaticMethod(engine, &AIVehicleStationList::GetClassName, "GetClassName", 1, "x"); |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
37 |
|
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
38 |
SQAIVehicleStationList.PostRegister(engine); |
25126afa0c25
(svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents:
9636
diff
changeset
|
39 |
} |