summaryrefslogtreecommitdiff
path: root/src/script/api/ai/ai_vehicle.hpp.sq
blob: dbd0096adafce9468987a37c0758f94414fc5ee3 (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
/* $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 "../script_vehicle.hpp"
#include "../template/template_vehicle.hpp.sq"


template <> const char *GetClassName<ScriptVehicle, ST_AI>() { return "AIVehicle"; }

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

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

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

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

	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_TOO_MANY,             "ERR_VEHICLE_TOO_MANY");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE,        "ERR_VEHICLE_NOT_AVAILABLE");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED,       "ERR_VEHICLE_BUILD_DISABLED");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT,          "ERR_VEHICLE_WRONG_DEPOT");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP,    "ERR_VEHICLE_CANNOT_START_STOP");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_TURN,          "ERR_VEHICLE_CANNOT_TURN");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT,         "ERR_VEHICLE_CANNOT_REFIT");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_IS_DESTROYED,         "ERR_VEHICLE_IS_DESTROYED");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT,         "ERR_VEHICLE_NOT_IN_DEPOT");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_IN_FLIGHT,            "ERR_VEHICLE_IN_FLIGHT");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NO_POWER,             "ERR_VEHICLE_NO_POWER");
	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_TOO_LONG,             "ERR_VEHICLE_TOO_LONG");

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

	SQAIVehicle.PostRegister(engine);
}