summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_rail.hpp.sq
blob: 9f9365e0df43c5c7666502e786f49affd3e2cf78 (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
/* $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_rail.hpp"

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

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

void SQAIRail_Register(Squirrel *engine)
{
	DefSQClass <AIRail> SQAIRail("AIRail");
	SQAIRail.PreRegister(engine);
	SQAIRail.AddConstructor<void (AIRail::*)(), 1>(engine, "x");

	SQAIRail.DefSQConst(engine, AIRail::ERR_RAIL_BASE,                    "ERR_RAIL_BASE");
	SQAIRail.DefSQConst(engine, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD,      "ERR_CROSSING_ON_ONEWAY_ROAD");
	SQAIRail.DefSQConst(engine, AIRail::ERR_UNSUITABLE_TRACK,             "ERR_UNSUITABLE_TRACK");
	SQAIRail.DefSQConst(engine, AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");
	SQAIRail.DefSQConst(engine, AIRail::RAILTYPE_INVALID,                 "RAILTYPE_INVALID");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SW,                  "RAILTRACK_NE_SW");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SE,                  "RAILTRACK_NW_SE");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_NE,                  "RAILTRACK_NW_NE");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_SW_SE,                  "RAILTRACK_SW_SE");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SW,                  "RAILTRACK_NW_SW");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SE,                  "RAILTRACK_NE_SE");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_INVALID,                "RAILTRACK_INVALID");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL,                "SIGNALTYPE_NORMAL");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY,                 "SIGNALTYPE_ENTRY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT,                  "SIGNALTYPE_EXIT");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO,                 "SIGNALTYPE_COMBO");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS,                   "SIGNALTYPE_PBS");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS_ONEWAY,            "SIGNALTYPE_PBS_ONEWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_TWOWAY,                "SIGNALTYPE_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL_TWOWAY,         "SIGNALTYPE_NORMAL_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY_TWOWAY,          "SIGNALTYPE_ENTRY_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT_TWOWAY,           "SIGNALTYPE_EXIT_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO_TWOWAY,          "SIGNALTYPE_COMBO_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NONE,                  "SIGNALTYPE_NONE");
	SQAIRail.DefSQConst(engine, AIRail::BT_TRACK,                         "BT_TRACK");
	SQAIRail.DefSQConst(engine, AIRail::BT_SIGNAL,                        "BT_SIGNAL");
	SQAIRail.DefSQConst(engine, AIRail::BT_DEPOT,                         "BT_DEPOT");
	SQAIRail.DefSQConst(engine, AIRail::BT_STATION,                       "BT_STATION");
	SQAIRail.DefSQConst(engine, AIRail::BT_WAYPOINT,                      "BT_WAYPOINT");

	AIError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD,        AIRail::ERR_CROSSING_ON_ONEWAY_ROAD);
	AIError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK,     AIRail::ERR_UNSUITABLE_TRACK);
	AIError::RegisterErrorMap(STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED, AIRail::ERR_NONUNIFORM_STATIONS_DISABLED);

	AIError::RegisterErrorMapString(AIRail::ERR_CROSSING_ON_ONEWAY_ROAD,      "ERR_CROSSING_ON_ONEWAY_ROAD");
	AIError::RegisterErrorMapString(AIRail::ERR_UNSUITABLE_TRACK,             "ERR_UNSUITABLE_TRACK");
	AIError::RegisterErrorMapString(AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");

	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailTile,                      "IsRailTile",                      2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsLevelCrossingTile,             "IsLevelCrossingTile",             2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailDepotTile,                 "IsRailDepotTile",                 2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailStationTile,               "IsRailStationTile",               2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailWaypointTile,              "IsRailWaypointTile",              2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailTypeAvailable,             "IsRailTypeAvailable",             2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetCurrentRailType,              "GetCurrentRailType",              1, ".");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::SetCurrentRailType,              "SetCurrentRailType",              2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::TrainCanRunOnRail,               "TrainCanRunOnRail",               3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::TrainHasPowerOnRail,             "TrainHasPowerOnRail",             3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailType,                     "GetRailType",                     2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::ConvertRailType,                 "ConvertRailType",                 4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailDepotFrontTile,           "GetRailDepotFrontTile",           2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailStationDirection,         "GetRailStationDirection",         2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailDepot,                  "BuildRailDepot",                  3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailStation,                "BuildRailStation",                6, ".iiiii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildNewGRFRailStation,          "BuildNewGRFRailStation",          11, ".iiiiiiiiib");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailWaypoint,               "BuildRailWaypoint",               2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailWaypointTileRectangle, "RemoveRailWaypointTileRectangle", 4, ".iib");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailStationTileRectangle,  "RemoveRailStationTileRectangle",  4, ".iib");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailTracks,                   "GetRailTracks",                   2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailTrack,                  "BuildRailTrack",                  3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailTrack,                 "RemoveRailTrack",                 3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::AreTilesConnected,               "AreTilesConnected",               4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRail,                       "BuildRail",                       4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRail,                      "RemoveRail",                      4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetSignalType,                   "GetSignalType",                   3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildSignal,                     "BuildSignal",                     4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveSignal,                    "RemoveSignal",                    3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetBuildCost,                    "GetBuildCost",                    3, ".ii");

	SQAIRail.PostRegister(engine);
}