author | truebrain |
Wed, 18 Jun 2008 20:20:44 +0000 | |
branch | noai |
changeset 11012 | 2a79a3bbe92a |
parent 10863 | 7b31d67e1553 |
child 11056 | d91b79ffff9c |
permissions | -rw-r--r-- |
10212
1e0a2a182253
(svn r12744) [NoAI] -Fix: added a comment to all .hpp.sq that those files are autogenerated, and shouldn't be manually altered
truebrain
parents:
10094
diff
changeset
|
1 |
/* $Id$ */ |
1e0a2a182253
(svn r12744) [NoAI] -Fix: added a comment to all .hpp.sq that those files are autogenerated, and shouldn't be manually altered
truebrain
parents:
10094
diff
changeset
|
2 |
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ |
1e0a2a182253
(svn r12744) [NoAI] -Fix: added a comment to all .hpp.sq that those files are autogenerated, and shouldn't be manually altered
truebrain
parents:
10094
diff
changeset
|
3 |
|
9638
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
4 |
#include "ai_station.hpp" |
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
5 |
|
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
6 |
namespace SQConvert { |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9666
diff
changeset
|
7 |
/* Allow enums to be used as Squirrel parameters */ |
10734
06f95974ac15
(svn r13284) [NoAI] -Change r13272: make the auto-free-pointers much more general, so in the future we can use it for other things, and not limited to strings
truebrain
parents:
10722
diff
changeset
|
8 |
template <> AIStation::ErrorMessages GetParam(ForceType<AIStation::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStation::ErrorMessages)tmp; } |
9866
efc38e1f559a
(svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents:
9814
diff
changeset
|
9 |
template <> int Return<AIStation::ErrorMessages>(HSQUIRRELVM vm, AIStation::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } |
10734
06f95974ac15
(svn r13284) [NoAI] -Change r13272: make the auto-free-pointers much more general, so in the future we can use it for other things, and not limited to strings
truebrain
parents:
10722
diff
changeset
|
10 |
template <> AIStation::StationType GetParam(ForceType<AIStation::StationType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStation::StationType)tmp; } |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9666
diff
changeset
|
11 |
template <> int Return<AIStation::StationType>(HSQUIRRELVM vm, AIStation::StationType res) { sq_pushinteger(vm, (int32)res); return 1; } |
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9666
diff
changeset
|
12 |
|
9638
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
13 |
/* Allow AIStation to be used as Squirrel parameter */ |
10734
06f95974ac15
(svn r13284) [NoAI] -Change r13272: make the auto-free-pointers much more general, so in the future we can use it for other things, and not limited to strings
truebrain
parents:
10722
diff
changeset
|
14 |
template <> AIStation *GetParam(ForceType<AIStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIStation *)instance; } |
06f95974ac15
(svn r13284) [NoAI] -Change r13272: make the auto-free-pointers much more general, so in the future we can use it for other things, and not limited to strings
truebrain
parents:
10722
diff
changeset
|
15 |
template <> AIStation &GetParam(ForceType<AIStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStation *)instance; } |
06f95974ac15
(svn r13284) [NoAI] -Change r13272: make the auto-free-pointers much more general, so in the future we can use it for other things, and not limited to strings
truebrain
parents:
10722
diff
changeset
|
16 |
template <> const AIStation *GetParam(ForceType<const AIStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIStation *)instance; } |
06f95974ac15
(svn r13284) [NoAI] -Change r13272: make the auto-free-pointers much more general, so in the future we can use it for other things, and not limited to strings
truebrain
parents:
10722
diff
changeset
|
17 |
template <> const AIStation &GetParam(ForceType<const AIStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStation *)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
|
18 |
template <> int Return<AIStation *>(HSQUIRRELVM vm, AIStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIStation", res, NULL, DefSQDestructorCallback<AIStation>); return 1; } |
9638
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
19 |
}; // namespace SQConvert |
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
20 |
|
9741
53c1c5850e01
(svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
truebrain
parents:
9696
diff
changeset
|
21 |
void SQAIStation_Register(Squirrel *engine) { |
9638
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
22 |
DefSQClass <AIStation> SQAIStation("AIStation"); |
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
23 |
SQAIStation.PreRegister(engine); |
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
24 |
SQAIStation.AddConstructor<void (AIStation::*)(), 1>(engine, "x"); |
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
25 |
|
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
26 |
SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_BASE, "ERR_STATION_BASE"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
27 |
SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_LARGE, "ERR_STATION_TOO_LARGE"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
28 |
SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
29 |
SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_MANY_STATIONS, "ERR_STATION_TOO_MANY_STATIONS"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
30 |
SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN, "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
31 |
SQAIStation.DefSQConst(engine, AIStation::STATION_TRAIN, "STATION_TRAIN"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
32 |
SQAIStation.DefSQConst(engine, AIStation::STATION_TRUCK_STOP, "STATION_TRUCK_STOP"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
33 |
SQAIStation.DefSQConst(engine, AIStation::STATION_BUS_STOP, "STATION_BUS_STOP"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
34 |
SQAIStation.DefSQConst(engine, AIStation::STATION_AIRPORT, "STATION_AIRPORT"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
35 |
SQAIStation.DefSQConst(engine, AIStation::STATION_DOCK, "STATION_DOCK"); |
11012
2a79a3bbe92a
(svn r13569) [NoAI] -Fix: for some silly reason STATION_ANY was 0x00, instead of 0x1F, greatly increasing the complexity of bitmask-checks, for no clear reason
truebrain
parents:
10863
diff
changeset
|
36 |
SQAIStation.DefSQConst(engine, AIStation::STATION_ANY, "STATION_ANY"); |
9866
efc38e1f559a
(svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents:
9814
diff
changeset
|
37 |
|
efc38e1f559a
(svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents:
9814
diff
changeset
|
38 |
AIError::RegisterErrorMap(STR_306C_STATION_TOO_SPREAD_OUT, AIStation::ERR_STATION_TOO_LARGE); |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
39 |
AIError::RegisterErrorMap(STR_300D_TOO_CLOSE_TO_ANOTHER_AIRPORT, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
40 |
AIError::RegisterErrorMap(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
41 |
AIError::RegisterErrorMap(STR_304C_TOO_CLOSE_TO_ANOTHER_DOCK, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
42 |
AIError::RegisterErrorMap(STR_3008_TOO_MANY_STATIONS_LOADING, AIStation::ERR_STATION_TOO_MANY_STATIONS); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
43 |
AIError::RegisterErrorMap(STR_TOO_MANY_TRUCK_STOPS, AIStation::ERR_STATION_TOO_MANY_STATIONS); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
44 |
AIError::RegisterErrorMap(STR_TOO_MANY_BUS_STOPS, AIStation::ERR_STATION_TOO_MANY_STATIONS); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
45 |
AIError::RegisterErrorMap(STR_3007_TOO_MANY_STATIONS_LOADING, AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN); |
9866
efc38e1f559a
(svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents:
9814
diff
changeset
|
46 |
|
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
47 |
AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_LARGE, "ERR_STATION_TOO_LARGE"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
48 |
AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
49 |
AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_MANY_STATIONS, "ERR_STATION_TOO_MANY_STATIONS"); |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9866
diff
changeset
|
50 |
AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN, "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN"); |
9670
820b77e19bb3
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents:
9666
diff
changeset
|
51 |
|
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
52 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetClassName, "GetClassName", 1, "x"); |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
53 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::IsValidStation, "IsValidStation", 2, "xi"); |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
54 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetStationID, "GetStationID", 2, "xi"); |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
55 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetName, "GetName", 2, "xi"); |
10381
4ad8b98acd82
(svn r12922) [NoAI] -Add: added AIStation::SetName() (Yexo)
truebrain
parents:
10361
diff
changeset
|
56 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::SetName, "SetName", 3, "xis"); |
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
57 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetLocation, "GetLocation", 2, "xi"); |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
58 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoWaiting, "GetCargoWaiting", 3, "xii"); |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
59 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoRating, "GetCargoRating", 3, "xii"); |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
60 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCoverageRadius, "GetCoverageRadius", 2, "xi"); |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
61 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, "xii"); |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9741
diff
changeset
|
62 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, "xii"); |
10361
4cdffd48480f
(svn r12902) [NoAI] -Fix r12901 [API CHANGE]: renamed IsWithinTownRadius to IsWithinTownInfluence, as that reflects the meaning much better
truebrain
parents:
10360
diff
changeset
|
63 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::IsWithinTownInfluence, "IsWithinTownInfluence", 3, "xii"); |
10863
7b31d67e1553
(svn r13414) [NoAI] -Add: added AIStation::HasStationType(station_id, station_type) to check if a given station has a given station-type
truebrain
parents:
10734
diff
changeset
|
64 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::HasStationType, "HasStationType", 3, "xii"); |
10668
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10381
diff
changeset
|
65 |
SQAIStation.DefSQStaticMethod(engine, &AIStation::HasRoadType, "HasRoadType", 3, "xii"); |
9638
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
66 |
|
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
67 |
SQAIStation.PostRegister(engine); |
f6d169a5a45a
(svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff
changeset
|
68 |
} |