summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_order.hpp.sq
blob: c6aa1c8736b340bfe63b56aabb408efe02f5afa8 (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
/* $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_order.hpp"

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

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

void SQAIOrder_Register(Squirrel *engine)
{
	DefSQClass <AIOrder> SQAIOrder("AIOrder");
	SQAIOrder.PreRegister(engine);
	SQAIOrder.AddConstructor<void (AIOrder::*)(), 1>(engine, "x");

	SQAIOrder.DefSQConst(engine, AIOrder::ERR_ORDER_BASE,                                   "ERR_ORDER_BASE");
	SQAIOrder.DefSQConst(engine, AIOrder::ERR_ORDER_TOO_MANY,                               "ERR_ORDER_TOO_MANY");
	SQAIOrder.DefSQConst(engine, AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NONE,                                        "AIOF_NONE");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NON_STOP_INTERMEDIATE,                       "AIOF_NON_STOP_INTERMEDIATE");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NON_STOP_DESTINATION,                        "AIOF_NON_STOP_DESTINATION");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_UNLOAD,                                      "AIOF_UNLOAD");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_TRANSFER,                                    "AIOF_TRANSFER");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NO_UNLOAD,                                   "AIOF_NO_UNLOAD");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_FULL_LOAD,                                   "AIOF_FULL_LOAD");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_FULL_LOAD_ANY,                               "AIOF_FULL_LOAD_ANY");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NO_LOAD,                                     "AIOF_NO_LOAD");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_SERVICE_IF_NEEDED,                           "AIOF_SERVICE_IF_NEEDED");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_STOP_IN_DEPOT,                               "AIOF_STOP_IN_DEPOT");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_GOTO_NEAREST_DEPOT,                          "AIOF_GOTO_NEAREST_DEPOT");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NON_STOP_FLAGS,                              "AIOF_NON_STOP_FLAGS");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_UNLOAD_FLAGS,                                "AIOF_UNLOAD_FLAGS");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_LOAD_FLAGS,                                  "AIOF_LOAD_FLAGS");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_DEPOT_FLAGS,                                 "AIOF_DEPOT_FLAGS");
	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_INVALID,                                     "AIOF_INVALID");
	SQAIOrder.DefSQConst(engine, AIOrder::OC_LOAD_PERCENTAGE,                               "OC_LOAD_PERCENTAGE");
	SQAIOrder.DefSQConst(engine, AIOrder::OC_RELIABILITY,                                   "OC_RELIABILITY");
	SQAIOrder.DefSQConst(engine, AIOrder::OC_MAX_SPEED,                                     "OC_MAX_SPEED");
	SQAIOrder.DefSQConst(engine, AIOrder::OC_AGE,                                           "OC_AGE");
	SQAIOrder.DefSQConst(engine, AIOrder::OC_REQUIRES_SERVICE,                              "OC_REQUIRES_SERVICE");
	SQAIOrder.DefSQConst(engine, AIOrder::OC_UNCONDITIONALLY,                               "OC_UNCONDITIONALLY");
	SQAIOrder.DefSQConst(engine, AIOrder::OC_INVALID,                                       "OC_INVALID");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_EQUALS,                                        "CF_EQUALS");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_NOT_EQUALS,                                    "CF_NOT_EQUALS");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_LESS_THAN,                                     "CF_LESS_THAN");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_LESS_EQUALS,                                   "CF_LESS_EQUALS");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_MORE_THAN,                                     "CF_MORE_THAN");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_MORE_EQUALS,                                   "CF_MORE_EQUALS");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_IS_TRUE,                                       "CF_IS_TRUE");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_IS_FALSE,                                      "CF_IS_FALSE");
	SQAIOrder.DefSQConst(engine, AIOrder::CF_INVALID,                                       "CF_INVALID");
	SQAIOrder.DefSQConst(engine, AIOrder::ORDER_CURRENT,                                    "ORDER_CURRENT");
	SQAIOrder.DefSQConst(engine, AIOrder::ORDER_INVALID,                                    "ORDER_INVALID");
	SQAIOrder.DefSQConst(engine, AIOrder::STOPLOCATION_NEAR,                                "STOPLOCATION_NEAR");
	SQAIOrder.DefSQConst(engine, AIOrder::STOPLOCATION_MIDDLE,                              "STOPLOCATION_MIDDLE");
	SQAIOrder.DefSQConst(engine, AIOrder::STOPLOCATION_FAR,                                 "STOPLOCATION_FAR");
	SQAIOrder.DefSQConst(engine, AIOrder::STOPLOCATION_INVALID,                             "STOPLOCATION_INVALID");

	AIError::RegisterErrorMap(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS,          AIOrder::ERR_ORDER_TOO_MANY);
	AIError::RegisterErrorMap(STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION, AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION);

	AIError::RegisterErrorMapString(AIOrder::ERR_ORDER_TOO_MANY,                               "ERR_ORDER_TOO_MANY");
	AIError::RegisterErrorMapString(AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");

	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidVehicleOrder,           "IsValidVehicleOrder",           3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoStationOrder,            "IsGotoStationOrder",            3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoDepotOrder,              "IsGotoDepotOrder",              3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoWaypointOrder,           "IsGotoWaypointOrder",           3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsConditionalOrder,            "IsConditionalOrder",            3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsCurrentOrderPartOfOrderList, "IsCurrentOrderPartOfOrderList", 2, ".i");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ResolveOrderPosition,          "ResolveOrderPosition",          3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AreOrderFlagsValid,            "AreOrderFlagsValid",            3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidConditionalOrder,       "IsValidConditionalOrder",       3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCount,                 "GetOrderCount",                 2, ".i");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderDestination,           "GetOrderDestination",           3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderFlags,                 "GetOrderFlags",                 3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderJumpTo,                "GetOrderJumpTo",                3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCondition,             "GetOrderCondition",             3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareFunction,       "GetOrderCompareFunction",       3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareValue,          "GetOrderCompareValue",          3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetStopLocation,               "GetStopLocation",               3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderJumpTo,                "SetOrderJumpTo",                4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCondition,             "SetOrderCondition",             4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareFunction,       "SetOrderCompareFunction",       4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareValue,          "SetOrderCompareValue",          4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetStopLocation,               "SetStopLocation",               4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendOrder,                   "AppendOrder",                   4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendConditionalOrder,        "AppendConditionalOrder",        3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertOrder,                   "InsertOrder",                   5, ".iiii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertConditionalOrder,        "InsertConditionalOrder",        4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::RemoveOrder,                   "RemoveOrder",                   3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderFlags,                 "SetOrderFlags",                 4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::MoveOrder,                     "MoveOrder",                     4, ".iii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SkipToOrder,                   "SkipToOrder",                   3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::CopyOrders,                    "CopyOrders",                    3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ShareOrders,                   "ShareOrders",                   3, ".ii");
	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::UnshareOrders,                 "UnshareOrders",                 2, ".i");

	SQAIOrder.PostRegister(engine);
}