summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-04-06 20:50:00 +0100
committerMichael Lutz <michi@icosahedron.de>2019-05-01 21:36:27 +0200
commit3293f08e0b1aa94319c29e7391eb2f5d6d4c5a17 (patch)
tree8e73e45a5aa7bcf8b97c69bce703f9b415ad1fda /src/script
parentc02ef3e4564b7b54d49f0827d2d7625cbc38f335 (diff)
downloadopenttd-3293f08e0b1aa94319c29e7391eb2f5d6d4c5a17.tar.xz
Add: New RoadType API functions.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/ai/ai_engine.hpp.sq2
-rw-r--r--src/script/api/ai/ai_road.hpp.sq3
-rw-r--r--src/script/api/ai/ai_roadtypelist.hpp.sq25
-rw-r--r--src/script/api/ai_changelog.hpp3
-rw-r--r--src/script/api/game/game_engine.hpp.sq2
-rw-r--r--src/script/api/game/game_road.hpp.sq3
-rw-r--r--src/script/api/game/game_roadtypelist.hpp.sq25
-rw-r--r--src/script/api/script_engine.cpp15
-rw-r--r--src/script/api/script_engine.hpp22
-rw-r--r--src/script/api/script_road.cpp9
-rw-r--r--src/script/api/script_road.hpp16
-rw-r--r--src/script/api/script_roadtypelist.cpp24
-rw-r--r--src/script/api/script_roadtypelist.hpp31
-rw-r--r--src/script/api/template/template_road.hpp.sq2
-rw-r--r--src/script/api/template/template_roadtypelist.hpp.sq21
15 files changed, 201 insertions, 2 deletions
diff --git a/src/script/api/ai/ai_engine.hpp.sq b/src/script/api/ai/ai_engine.hpp.sq
index 6dbde2909..b10e7e34f 100644
--- a/src/script/api/ai/ai_engine.hpp.sq
+++ b/src/script/api/ai/ai_engine.hpp.sq
@@ -41,6 +41,8 @@ void SQAIEngine_Register(Squirrel *engine)
SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::IsWagon, "IsWagon", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::CanRunOnRail, "CanRunOnRail", 3, ".ii");
SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::HasPowerOnRail, "HasPowerOnRail", 3, ".ii");
+ SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::CanRunOnRoad, "CanRunOnRoad", 3, ".ii");
+ SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::HasPowerOnRoad, "HasPowerOnRoad", 3, ".ii");
SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRoadType, "GetRoadType", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRailType, "GetRailType", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::IsArticulated, "IsArticulated", 2, ".i");
diff --git a/src/script/api/ai/ai_road.hpp.sq b/src/script/api/ai/ai_road.hpp.sq
index 350fcdb7f..7e91fb268 100644
--- a/src/script/api/ai/ai_road.hpp.sq
+++ b/src/script/api/ai/ai_road.hpp.sq
@@ -31,6 +31,8 @@ void SQAIRoad_Register(Squirrel *engine)
SQAIRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_ROAD, "ROADTYPE_ROAD");
SQAIRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_TRAM, "ROADTYPE_TRAM");
SQAIRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_INVALID, "ROADTYPE_INVALID");
+ SQAIRoad.DefSQConst(engine, ScriptRoad::ROADTRAMTYPES_ROAD, "ROADTRAMTYPES_ROAD");
+ SQAIRoad.DefSQConst(engine, ScriptRoad::ROADTRAMTYPES_TRAM, "ROADTRAMTYPES_TRAM");
SQAIRoad.DefSQConst(engine, ScriptRoad::ROADVEHTYPE_BUS, "ROADVEHTYPE_BUS");
SQAIRoad.DefSQConst(engine, ScriptRoad::ROADVEHTYPE_TRUCK, "ROADVEHTYPE_TRUCK");
SQAIRoad.DefSQConst(engine, ScriptRoad::BT_ROAD, "BT_ROAD");
@@ -86,6 +88,7 @@ void SQAIRoad_Register(Squirrel *engine)
SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::RemoveRoadDepot, "RemoveRoadDepot", 2, ".i");
SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::RemoveRoadStation, "RemoveRoadStation", 2, ".i");
SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetBuildCost, "GetBuildCost", 3, ".ii");
+ SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadTramType, "GetRoadTramType", 2, ".i");
SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetMaxSpeed, "GetMaxSpeed", 2, ".i");
SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetMaintenanceCostFactor, "GetMaintenanceCostFactor", 2, ".i");
diff --git a/src/script/api/ai/ai_roadtypelist.hpp.sq b/src/script/api/ai/ai_roadtypelist.hpp.sq
new file mode 100644
index 000000000..cbe316f8d
--- /dev/null
+++ b/src/script/api/ai/ai_roadtypelist.hpp.sq
@@ -0,0 +1,25 @@
+/* $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_roadtypelist.hpp"
+#include "../template/template_roadtypelist.hpp.sq"
+
+
+template <> const char *GetClassName<ScriptRoadTypeList, ST_AI>() { return "AIRoadTypeList"; }
+
+void SQAIRoadTypeList_Register(Squirrel *engine)
+{
+ DefSQClass<ScriptRoadTypeList, ST_AI> SQAIRoadTypeList("AIRoadTypeList");
+ SQAIRoadTypeList.PreRegister(engine, "AIList");
+ SQAIRoadTypeList.AddConstructor<void (ScriptRoadTypeList::*)(ScriptRoad::RoadTramTypes rtts), 2>(engine, "xi");
+
+ SQAIRoadTypeList.PostRegister(engine);
+}
diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp
index 89922d4b2..5aacf8e8c 100644
--- a/src/script/api/ai_changelog.hpp
+++ b/src/script/api/ai_changelog.hpp
@@ -31,6 +31,9 @@
* \li AIRoad::RoadVehHasPowerOnRoad
* \li AIRoad::ConvertRoadType
* \li AIRoad::GetMaxSpeed
+ * \li AIEngine::CanRunOnRoad
+ * \li AIEngine::HasPowerOnRoad
+ * \li AIRoadTypeList::RoadTypeList
*
* \b 1.9.0
*
diff --git a/src/script/api/game/game_engine.hpp.sq b/src/script/api/game/game_engine.hpp.sq
index 488175547..67153b1d9 100644
--- a/src/script/api/game/game_engine.hpp.sq
+++ b/src/script/api/game/game_engine.hpp.sq
@@ -41,6 +41,8 @@ void SQGSEngine_Register(Squirrel *engine)
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::IsWagon, "IsWagon", 2, ".i");
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::CanRunOnRail, "CanRunOnRail", 3, ".ii");
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::HasPowerOnRail, "HasPowerOnRail", 3, ".ii");
+ SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::CanRunOnRoad, "CanRunOnRoad", 3, ".ii");
+ SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::HasPowerOnRoad, "HasPowerOnRoad", 3, ".ii");
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRoadType, "GetRoadType", 2, ".i");
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRailType, "GetRailType", 2, ".i");
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::IsArticulated, "IsArticulated", 2, ".i");
diff --git a/src/script/api/game/game_road.hpp.sq b/src/script/api/game/game_road.hpp.sq
index 650d31504..725e24bf1 100644
--- a/src/script/api/game/game_road.hpp.sq
+++ b/src/script/api/game/game_road.hpp.sq
@@ -31,6 +31,8 @@ void SQGSRoad_Register(Squirrel *engine)
SQGSRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_ROAD, "ROADTYPE_ROAD");
SQGSRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_TRAM, "ROADTYPE_TRAM");
SQGSRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_INVALID, "ROADTYPE_INVALID");
+ SQGSRoad.DefSQConst(engine, ScriptRoad::ROADTRAMTYPES_ROAD, "ROADTRAMTYPES_ROAD");
+ SQGSRoad.DefSQConst(engine, ScriptRoad::ROADTRAMTYPES_TRAM, "ROADTRAMTYPES_TRAM");
SQGSRoad.DefSQConst(engine, ScriptRoad::ROADVEHTYPE_BUS, "ROADVEHTYPE_BUS");
SQGSRoad.DefSQConst(engine, ScriptRoad::ROADVEHTYPE_TRUCK, "ROADVEHTYPE_TRUCK");
SQGSRoad.DefSQConst(engine, ScriptRoad::BT_ROAD, "BT_ROAD");
@@ -86,6 +88,7 @@ void SQGSRoad_Register(Squirrel *engine)
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::RemoveRoadDepot, "RemoveRoadDepot", 2, ".i");
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::RemoveRoadStation, "RemoveRoadStation", 2, ".i");
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetBuildCost, "GetBuildCost", 3, ".ii");
+ SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadTramType, "GetRoadTramType", 2, ".i");
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetMaxSpeed, "GetMaxSpeed", 2, ".i");
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetMaintenanceCostFactor, "GetMaintenanceCostFactor", 2, ".i");
diff --git a/src/script/api/game/game_roadtypelist.hpp.sq b/src/script/api/game/game_roadtypelist.hpp.sq
new file mode 100644
index 000000000..f61adaa8f
--- /dev/null
+++ b/src/script/api/game/game_roadtypelist.hpp.sq
@@ -0,0 +1,25 @@
+/* $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_roadtypelist.hpp"
+#include "../template/template_roadtypelist.hpp.sq"
+
+
+template <> const char *GetClassName<ScriptRoadTypeList, ST_GS>() { return "GSRoadTypeList"; }
+
+void SQGSRoadTypeList_Register(Squirrel *engine)
+{
+ DefSQClass<ScriptRoadTypeList, ST_GS> SQGSRoadTypeList("GSRoadTypeList");
+ SQGSRoadTypeList.PreRegister(engine, "GSList");
+ SQGSRoadTypeList.AddConstructor<void (ScriptRoadTypeList::*)(ScriptRoad::RoadTramTypes rtts), 2>(engine, "xi");
+
+ SQGSRoadTypeList.PostRegister(engine);
+}
diff --git a/src/script/api/script_engine.cpp b/src/script/api/script_engine.cpp
index 97f8c71df..88f55226e 100644
--- a/src/script/api/script_engine.cpp
+++ b/src/script/api/script_engine.cpp
@@ -15,6 +15,7 @@
#include "../../company_base.h"
#include "../../strings_func.h"
#include "../../rail.h"
+#include "../../road.h"
#include "../../engine_base.h"
#include "../../engine_func.h"
#include "../../articulated_vehicles.h"
@@ -219,6 +220,20 @@
return ::HasPowerOnRail((::RailType)::RailVehInfo(engine_id)->railtype, (::RailType)track_rail_type);
}
+/* static */ bool ScriptEngine::CanRunOnRoad(EngineID engine_id, ScriptRoad::RoadType road_type)
+{
+ return HasPowerOnRoad(engine_id, road_type);
+}
+
+/* static */ bool ScriptEngine::HasPowerOnRoad(EngineID engine_id, ScriptRoad::RoadType road_type)
+{
+ if (!IsValidEngine(engine_id)) return false;
+ if (GetVehicleType(engine_id) != ScriptVehicle::VT_ROAD) return false;
+ if (!ScriptRoad::IsRoadTypeAvailable(road_type)) return false;
+
+ return ::HasPowerOnRoad((::RoadType)::RoadVehInfo(engine_id)->roadtype, (::RoadType)road_type);
+}
+
/* static */ ScriptRoad::RoadType ScriptEngine::GetRoadType(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return ScriptRoad::ROADTYPE_INVALID;
diff --git a/src/script/api/script_engine.hpp b/src/script/api/script_engine.hpp
index 173377742..b08b6f64b 100644
--- a/src/script/api/script_engine.hpp
+++ b/src/script/api/script_engine.hpp
@@ -218,6 +218,28 @@ public:
static bool HasPowerOnRail(EngineID engine_id, ScriptRail::RailType track_rail_type);
/**
+ * Check if a road vehicle can run on a RoadType.
+ * @param engine_id The engine to check.
+ * @param road_type Another RoadType.
+ * @pre IsValidEngine(engine_id).
+ * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_ROAD.
+ * @pre ScriptRoad::IsRoadTypeAvailable(road_type).
+ * @return Whether an engine of type 'engine_id' can run on 'road_type'.
+ */
+ static bool CanRunOnRoad(EngineID engine_id, ScriptRoad::RoadType road_type);
+
+ /**
+ * Check if a road vehicle has power on a RoadType.
+ * @param engine_id The engine to check.
+ * @param road_type Another RoadType.
+ * @pre IsValidEngine(engine_id).
+ * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_ROAD.
+ * @pre ScriptRoad::IsRoadTypeAvailable(road_type).
+ * @return Whether an engine of type 'engine_id' has power on 'road_type'.
+ */
+ static bool HasPowerOnRoad(EngineID engine_id, ScriptRoad::RoadType road_type);
+
+ /**
* Get the RoadType of the engine.
* @param engine_id The engine to get the RoadType of.
* @pre IsValidEngine(engine_id).
diff --git a/src/script/api/script_road.cpp b/src/script/api/script_road.cpp
index 327978f6a..afa4b28d3 100644
--- a/src/script/api/script_road.cpp
+++ b/src/script/api/script_road.cpp
@@ -97,7 +97,7 @@
{
if (!ScriptMap::IsValidTile(tile)) return false;
if (!IsRoadTypeAvailable(road_type)) return false;
- return ::GetAnyRoadBits(tile, GetRoadTramType((::RoadType)road_type), false) != ROAD_NONE;
+ return ::GetAnyRoadBits(tile, ::GetRoadTramType((::RoadType)road_type), false) != ROAD_NONE;
}
/* static */ bool ScriptRoad::AreRoadTilesConnected(TileIndex t1, TileIndex t2)
@@ -109,7 +109,7 @@
/* Tiles not neighbouring */
if ((abs((int)::TileX(t1) - (int)::TileX(t2)) + abs((int)::TileY(t1) - (int)::TileY(t2))) != 1) return false;
- RoadTramType rtt = GetRoadTramType(ScriptObject::GetRoadType());
+ RoadTramType rtt = ::GetRoadTramType(ScriptObject::GetRoadType());
RoadBits r1 = ::GetAnyRoadBits(t1, rtt); // TODO
RoadBits r2 = ::GetAnyRoadBits(t2, rtt); // TODO
@@ -627,6 +627,11 @@ static bool NeighbourHasReachableRoad(::RoadType rt, TileIndex start_tile, DiagD
}
}
+/* static */ ScriptRoad::RoadTramTypes ScriptRoad::GetRoadTramType(RoadType roadtype)
+{
+ return (RoadTramTypes)(1 << ::GetRoadTramType((::RoadType)roadtype));
+}
+
/* static */ int32 ScriptRoad::GetMaxSpeed(RoadType road_type)
{
if (!ScriptRoad::IsRoadTypeAvailable(road_type)) return 0;
diff --git a/src/script/api/script_road.hpp b/src/script/api/script_road.hpp
index 6da45acc2..39cf0420b 100644
--- a/src/script/api/script_road.hpp
+++ b/src/script/api/script_road.hpp
@@ -13,6 +13,7 @@
#define SCRIPT_ROAD_HPP
#include "script_tile.hpp"
+#include "../../../road.h"
/**
* Class that handles all road related functions.
@@ -59,6 +60,14 @@ public:
};
/**
+ * Road/tram types
+ */
+ enum RoadTramTypes {
+ ROADTRAMTYPES_ROAD = ::RTTB_ROAD, ///< Road road types.
+ ROADTRAMTYPES_TRAM = ::RTTB_TRAM, ///< Tram road types.
+ };
+
+ /**
* Type of road station.
*/
enum RoadVehicleType {
@@ -538,6 +547,13 @@ public:
static Money GetBuildCost(RoadType roadtype, BuildType build_type);
/**
+ * Test if a road type is for road or trams.
+ * @param roadtype the roadtype to test.
+ * @return RoadTramTypes of the road types.
+ */
+ static RoadTramTypes GetRoadTramType(RoadType roadtype);
+
+ /**
* Get the maximum speed of road vehicles running on this roadtype.
* @param road_type The roadtype to get the maximum speed of.
* @pre IsRoadTypeAvailable(road_type)
diff --git a/src/script/api/script_roadtypelist.cpp b/src/script/api/script_roadtypelist.cpp
new file mode 100644
index 000000000..a6d6c4ae6
--- /dev/null
+++ b/src/script/api/script_roadtypelist.cpp
@@ -0,0 +1,24 @@
+/* $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/>.
+ */
+
+/** @file script_roadtypelist.cpp Implementation of ScriptRoadTypeList and friends. */
+
+#include "../../stdafx.h"
+#include "script_roadtypelist.hpp"
+#include "../../road_func.h"
+
+#include "../../safeguards.h"
+
+ScriptRoadTypeList::ScriptRoadTypeList(ScriptRoad::RoadTramTypes rtts)
+{
+ for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
+ if (!HasBit(rtts, GetRoadTramType(rt))) continue;
+ if (ScriptObject::GetCompany() == OWNER_DEITY || ::HasRoadTypeAvail(ScriptObject::GetCompany(), rt)) this->AddItem(rt);
+ }
+}
diff --git a/src/script/api/script_roadtypelist.hpp b/src/script/api/script_roadtypelist.hpp
new file mode 100644
index 000000000..cbcd7fd46
--- /dev/null
+++ b/src/script/api/script_roadtypelist.hpp
@@ -0,0 +1,31 @@
+/* $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/>.
+ */
+
+/** @file script_roadtypelist.hpp List all available roadtypes. */
+
+#ifndef SCRIPT_ROADTYPELIST_HPP
+#define SCRIPT_ROADTYPELIST_HPP
+
+#include "script_list.hpp"
+#include "script_road.hpp"
+
+/**
+ * Creates a list of all available roadtypes.
+ * @api ai game
+ * @ingroup ScriptList
+ */
+class ScriptRoadTypeList : public ScriptList {
+public:
+ /**
+ * @param rtts Bitmask of road/tram types to list.
+ */
+ ScriptRoadTypeList(ScriptRoad::RoadTramTypes rtts);
+};
+
+#endif /* SCRIPT_ROADTYPELIST_HPP */
diff --git a/src/script/api/template/template_road.hpp.sq b/src/script/api/template/template_road.hpp.sq
index bf9a32082..26ef7a142 100644
--- a/src/script/api/template/template_road.hpp.sq
+++ b/src/script/api/template/template_road.hpp.sq
@@ -17,6 +17,8 @@ namespace SQConvert {
template <> inline int Return<ScriptRoad::ErrorMessages>(HSQUIRRELVM vm, ScriptRoad::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptRoad::RoadType GetParam(ForceType<ScriptRoad::RoadType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadType)tmp; }
template <> inline int Return<ScriptRoad::RoadType>(HSQUIRRELVM vm, ScriptRoad::RoadType res) { sq_pushinteger(vm, (int32)res); return 1; }
+ template <> inline ScriptRoad::RoadTramTypes GetParam(ForceType<ScriptRoad::RoadTramTypes>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadTramTypes)tmp; }
+ template <> inline int Return<ScriptRoad::RoadTramTypes>(HSQUIRRELVM vm, ScriptRoad::RoadTramTypes res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptRoad::RoadVehicleType GetParam(ForceType<ScriptRoad::RoadVehicleType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadVehicleType)tmp; }
template <> inline int Return<ScriptRoad::RoadVehicleType>(HSQUIRRELVM vm, ScriptRoad::RoadVehicleType res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptRoad::BuildType GetParam(ForceType<ScriptRoad::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::BuildType)tmp; }
diff --git a/src/script/api/template/template_roadtypelist.hpp.sq b/src/script/api/template/template_roadtypelist.hpp.sq
new file mode 100644
index 000000000..5573f8614
--- /dev/null
+++ b/src/script/api/template/template_roadtypelist.hpp.sq
@@ -0,0 +1,21 @@
+/* $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_roadtypelist.hpp"
+
+namespace SQConvert {
+ /* Allow ScriptRoadTypeList to be used as Squirrel parameter */
+ template <> inline ScriptRoadTypeList *GetParam(ForceType<ScriptRoadTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRoadTypeList *)instance; }
+ template <> inline ScriptRoadTypeList &GetParam(ForceType<ScriptRoadTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRoadTypeList *)instance; }
+ template <> inline const ScriptRoadTypeList *GetParam(ForceType<const ScriptRoadTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRoadTypeList *)instance; }
+ template <> inline const ScriptRoadTypeList &GetParam(ForceType<const ScriptRoadTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRoadTypeList *)instance; }
+ template <> inline int Return<ScriptRoadTypeList *>(HSQUIRRELVM vm, ScriptRoadTypeList *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "RoadTypeList", res, nullptr, DefSQDestructorCallback<ScriptRoadTypeList>, true); return 1; }
+} // namespace SQConvert