summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_vehicle.hpp.sq
blob: 98fedbf332a0c73b262f087e491c24cb2a277cd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/* $Id$ */

/*
 * This file is part of OpenTTD.
 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 */

/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */

#include "ai_vehicle.hpp"

namespace SQConvert {
	/* Allow enums to be used as Squirrel parameters */
	template <> AIVehicle::ErrorMessages GetParam(ForceType<AIVehicle::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIVehicle::ErrorMessages)tmp; }
	template <> int Return<AIVehicle::ErrorMessages>(HSQUIRRELVM vm, AIVehicle::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
	template <> AIVehicle::VehicleType GetParam(ForceType<AIVehicle::VehicleType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIVehicle::VehicleType)tmp; }
	template <> int Return<AIVehicle::VehicleType>(HSQUIRRELVM vm, AIVehicle::VehicleType res) { sq_pushinteger(vm, (int32)res); return 1; }
	template <> AIVehicle::VehicleState GetParam(ForceType<AIVehicle::VehicleState>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIVehicle::VehicleState)tmp; }
	template <> int Return<AIVehicle::VehicleState>(HSQUIRRELVM vm, AIVehicle::VehicleState res) { sq_pushinteger(vm, (int32)res); return 1; }

	/* Allow AIVehicle to be used as Squirrel parameter */
	template <> AIVehicle *GetParam(ForceType<AIVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicle *)instance; }
	template <> AIVehicle &GetParam(ForceType<AIVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicle *)instance; }
	template <> const AIVehicle *GetParam(ForceType<const AIVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicle *)instance; }
	template <> const AIVehicle &GetParam(ForceType<const AIVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicle *)instance; }
	template <> int Return<AIVehicle *>(HSQUIRRELVM vm, AIVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicle", res, NULL, DefSQDestructorCallback<AIVehicle>); return 1; }
} // namespace SQConvert

void SQAIVehicle_Register(Squirrel *engine)
{
	DefSQClass <AIVehicle> SQAIVehicle("AIVehicle");
	SQAIVehicle.PreRegister(engine);
	SQAIVehicle.AddConstructor<void (AIVehicle::*)(), 1>(engine, "x");

	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_BASE,                 "ERR_VEHICLE_BASE");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_TOO_MANY,             "ERR_VEHICLE_TOO_MANY");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NOT_AVAILABLE,        "ERR_VEHICLE_NOT_AVAILABLE");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_BUILD_DISABLED,       "ERR_VEHICLE_BUILD_DISABLED");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_WRONG_DEPOT,          "ERR_VEHICLE_WRONG_DEPOT");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_CANNOT_START_STOP,    "ERR_VEHICLE_CANNOT_START_STOP");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_CANNOT_TURN,          "ERR_VEHICLE_CANNOT_TURN");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_CANNOT_REFIT,         "ERR_VEHICLE_CANNOT_REFIT");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_IS_DESTROYED,         "ERR_VEHICLE_IS_DESTROYED");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT,         "ERR_VEHICLE_NOT_IN_DEPOT");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_IN_FLIGHT,            "ERR_VEHICLE_IN_FLIGHT");
	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NO_POWER,             "ERR_VEHICLE_NO_POWER");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_RAIL,                          "VT_RAIL");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_ROAD,                          "VT_ROAD");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_WATER,                         "VT_WATER");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_AIR,                           "VT_AIR");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_INVALID,                       "VT_INVALID");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_RUNNING,                       "VS_RUNNING");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_STOPPED,                       "VS_STOPPED");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_IN_DEPOT,                      "VS_IN_DEPOT");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_AT_STATION,                    "VS_AT_STATION");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_BROKEN,                        "VS_BROKEN");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_CRASHED,                       "VS_CRASHED");
	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_INVALID,                       "VS_INVALID");

	SQAIVehicle.DefSQConst(engine, AIVehicle::VEHICLE_INVALID, "VEHICLE_INVALID");

	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME,                           AIVehicle::ERR_VEHICLE_TOO_MANY);
	AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_NOT_AVAILABLE,                              AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
	AIError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_NOT_AVAILABLE,                          AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
	AIError::RegisterErrorMap(STR_ERROR_SHIP_NOT_AVAILABLE,                                  AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
	AIError::RegisterErrorMap(STR_ERROR_RAIL_VEHICLE_NOT_AVAILABLE,                          AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_TRAIN,                                     AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_ROAD_VEHICLE,                              AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_SHIP,                                      AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_AIRCRAFT,                                  AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
	AIError::RegisterErrorMap(STR_ERROR_DEPOT_WRONG_DEPOT_TYPE,                              AIVehicle::ERR_VEHICLE_WRONG_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_TRAIN_TO_DEPOT,                           AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_ROAD_VEHICLE_TO_DEPOT,                    AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_SHIP_TO_DEPOT,                            AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_AIRCRAFT_TO_HANGAR,                       AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_TRAIN,                              AIVehicle::ERR_VEHICLE_CANNOT_START_STOP);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_ROAD_VEHICLE,                       AIVehicle::ERR_VEHICLE_CANNOT_START_STOP);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_SHIP,                               AIVehicle::ERR_VEHICLE_CANNOT_START_STOP);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_AIRCRAFT,                           AIVehicle::ERR_VEHICLE_CANNOT_START_STOP);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_MAKE_ROAD_VEHICLE_TURN,                        AIVehicle::ERR_VEHICLE_CANNOT_TURN);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_TRAIN,                       AIVehicle::ERR_VEHICLE_CANNOT_TURN);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE,                AIVehicle::ERR_VEHICLE_CANNOT_TURN);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE_MULTIPLE_UNITS, AIVehicle::ERR_VEHICLE_CANNOT_TURN);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_TRAIN,                                   AIVehicle::ERR_VEHICLE_CANNOT_REFIT);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_ROAD_VEHICLE,                            AIVehicle::ERR_VEHICLE_CANNOT_REFIT);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_SHIP,                                    AIVehicle::ERR_VEHICLE_CANNOT_REFIT);
	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_AIRCRAFT,                                AIVehicle::ERR_VEHICLE_CANNOT_REFIT);
	AIError::RegisterErrorMap(STR_ERROR_VEHICLE_IS_DESTROYED,                                AIVehicle::ERR_VEHICLE_IS_DESTROYED);
	AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_MUST_BE_STOPPED_INSIDE_HANGAR,              AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_MUST_BE_STOPPED_INSIDE_DEPOT,           AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT,                  AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_SHIP_MUST_BE_STOPPED_INSIDE_DEPOT,                   AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
	AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_IS_IN_FLIGHT,                               AIVehicle::ERR_VEHICLE_IN_FLIGHT);
	AIError::RegisterErrorMap(STR_ERROR_TRAIN_START_NO_CATENARY,                             AIVehicle::ERR_VEHICLE_NO_POWER);

	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_TOO_MANY,             "ERR_VEHICLE_TOO_MANY");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NOT_AVAILABLE,        "ERR_VEHICLE_NOT_AVAILABLE");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_BUILD_DISABLED,       "ERR_VEHICLE_BUILD_DISABLED");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_WRONG_DEPOT,          "ERR_VEHICLE_WRONG_DEPOT");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_CANNOT_START_STOP,    "ERR_VEHICLE_CANNOT_START_STOP");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_CANNOT_TURN,          "ERR_VEHICLE_CANNOT_TURN");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_CANNOT_REFIT,         "ERR_VEHICLE_CANNOT_REFIT");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_IS_DESTROYED,         "ERR_VEHICLE_IS_DESTROYED");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT,         "ERR_VEHICLE_NOT_IN_DEPOT");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_IN_FLIGHT,            "ERR_VEHICLE_IN_FLIGHT");
	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NO_POWER,             "ERR_VEHICLE_NO_POWER");

	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidVehicle,                 "IsValidVehicle",                 2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetNumWagons,                   "GetNumWagons",                   2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SetName,                        "SetName",                        3, ".i.");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetName,                        "GetName",                        2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLocation,                    "GetLocation",                    2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetEngineType,                  "GetEngineType",                  2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetWagonEngineType,             "GetWagonEngineType",             3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetUnitNumber,                  "GetUnitNumber",                  2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAge,                         "GetAge",                         2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetWagonAge,                    "GetWagonAge",                    3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetMaxAge,                      "GetMaxAge",                      2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAgeLeft,                     "GetAgeLeft",                     2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCurrentSpeed,                "GetCurrentSpeed",                2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetState,                       "GetState",                       2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRunningCost,                 "GetRunningCost",                 2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitThisYear,              "GetProfitThisYear",              2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitLastYear,              "GetProfitLastYear",              2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCurrentValue,                "GetCurrentValue",                2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetVehicleType,                 "GetVehicleType",                 2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRoadType,                    "GetRoadType",                    2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsInDepot,                      "IsInDepot",                      2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsStoppedInDepot,               "IsStoppedInDepot",               2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::BuildVehicle,                   "BuildVehicle",                   3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::CloneVehicle,                   "CloneVehicle",                   4, ".iib");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::MoveWagon,                      "MoveWagon",                      5, ".iiii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::MoveWagonChain,                 "MoveWagonChain",                 5, ".iiii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRefitCapacity,               "GetRefitCapacity",               3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::RefitVehicle,                   "RefitVehicle",                   3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellVehicle,                    "SellVehicle",                    2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellWagon,                      "SellWagon",                      3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellWagonChain,                 "SellWagonChain",                 3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepot,             "SendVehicleToDepot",             2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepotForServicing, "SendVehicleToDepotForServicing", 2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::StartStopVehicle,               "StartStopVehicle",               2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::ReverseVehicle,                 "ReverseVehicle",                 2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCapacity,                    "GetCapacity",                    3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLength,                      "GetLength",                      2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCargoLoad,                   "GetCargoLoad",                   3, ".ii");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetGroupID,                     "GetGroupID",                     2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsArticulated,                  "IsArticulated",                  2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::HasSharedOrders,                "HasSharedOrders",                2, ".i");
	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetReliability,                 "GetReliability",                 2, ".i");

	SQAIVehicle.PostRegister(engine);
}