summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/script/api/script_bridge.cpp1
-rw-r--r--src/script/api/script_bridge.hpp3
-rw-r--r--src/script/api/script_road.cpp3
-rw-r--r--src/script/api/script_road.hpp3
-rw-r--r--src/script/api/script_tunnel.cpp1
-rw-r--r--src/script/api/script_tunnel.hpp4
6 files changed, 12 insertions, 3 deletions
diff --git a/src/script/api/script_bridge.cpp b/src/script/api/script_bridge.cpp
index 8cd11b311..25f9fc454 100644
--- a/src/script/api/script_bridge.cpp
+++ b/src/script/api/script_bridge.cpp
@@ -73,6 +73,7 @@ static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance)
EnforcePrecondition(false, TileX(start) == TileX(end) || TileY(start) == TileY(end));
EnforcePrecondition(false, vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_WATER);
EnforcePrecondition(false, vehicle_type != ScriptVehicle::VT_RAIL || ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType()));
+ EnforcePrecondition(false, vehicle_type != ScriptVehicle::VT_ROAD || ScriptRoad::IsRoadTypeAvailable(ScriptRoad::GetCurrentRoadType()));
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY || vehicle_type == ScriptVehicle::VT_ROAD);
uint type = 0;
diff --git a/src/script/api/script_bridge.hpp b/src/script/api/script_bridge.hpp
index 8a00206fd..e06928596 100644
--- a/src/script/api/script_bridge.hpp
+++ b/src/script/api/script_bridge.hpp
@@ -133,7 +133,8 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* ScriptMap::GetTileX(start) == ScriptMap::GetTileX(end) or
* ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
- * @pre vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_WATER ||
+ * @pre vehicle_type == ScriptVehicle::VT_WATER ||
+ * (vehicle_type == ScriptVehicle::VT_ROAD && ScriptRoad::IsRoadTypeAvailable(ScriptRoad::GetCurrentRoadType())) ||
* (vehicle_type == ScriptVehicle::VT_RAIL && ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType())).
* @game @pre Outside CompanyMode: vehicle_type == ScriptVehicle::VT_ROAD.
* @exception ScriptError::ERR_ALREADY_BUILT
diff --git a/src/script/api/script_road.cpp b/src/script/api/script_road.cpp
index e4980296c..445446695 100644
--- a/src/script/api/script_road.cpp
+++ b/src/script/api/script_road.cpp
@@ -32,6 +32,7 @@
/* static */ bool ScriptRoad::IsRoadDepotTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
+ if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
return ::IsTileType(tile, MP_ROAD) && ::GetRoadTileType(tile) == ROAD_TILE_DEPOT &&
(::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType()) & ::GetRoadTypes(tile)) != 0;
@@ -40,6 +41,7 @@
/* static */ bool ScriptRoad::IsRoadStationTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
+ if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
return ::IsRoadStopTile(tile) && (::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType()) & ::GetRoadTypes(tile)) != 0;
}
@@ -47,6 +49,7 @@
/* static */ bool ScriptRoad::IsDriveThroughRoadStationTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
+ if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
return ::IsDriveThroughStopTile(tile) && (::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType()) & ::GetRoadTypes(tile)) != 0;
}
diff --git a/src/script/api/script_road.hpp b/src/script/api/script_road.hpp
index 36290e2cc..ed4058f97 100644
--- a/src/script/api/script_road.hpp
+++ b/src/script/api/script_road.hpp
@@ -93,6 +93,7 @@ public:
* Checks whether the given tile is actually a tile with a road depot.
* @param tile The tile to check.
* @pre ScriptMap::IsValidTile(tile).
+ * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @return True if and only if the tile has a road depot.
*/
static bool IsRoadDepotTile(TileIndex tile);
@@ -101,6 +102,7 @@ public:
* Checks whether the given tile is actually a tile with a road station.
* @param tile The tile to check.
* @pre ScriptMap::IsValidTile(tile).
+ * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @return True if and only if the tile has a road station.
*/
static bool IsRoadStationTile(TileIndex tile);
@@ -110,6 +112,7 @@ public:
* road station.
* @param tile The tile to check.
* @pre ScriptMap::IsValidTile(tile).
+ * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @return True if and only if the tile has a drive through road station.
*/
static bool IsDriveThroughRoadStationTile(TileIndex tile);
diff --git a/src/script/api/script_tunnel.cpp b/src/script/api/script_tunnel.cpp
index cf228e415..97085688f 100644
--- a/src/script/api/script_tunnel.cpp
+++ b/src/script/api/script_tunnel.cpp
@@ -82,6 +82,7 @@ static void _DoCommandReturnBuildTunnel1(class ScriptInstance *instance)
EnforcePrecondition(false, ::IsValidTile(start));
EnforcePrecondition(false, vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_ROAD);
EnforcePrecondition(false, vehicle_type != ScriptVehicle::VT_RAIL || ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType()));
+ EnforcePrecondition(false, vehicle_type != ScriptVehicle::VT_ROAD || ScriptRoad::IsRoadTypeAvailable(ScriptRoad::GetCurrentRoadType()));
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY || vehicle_type == ScriptVehicle::VT_ROAD);
uint type = 0;
diff --git a/src/script/api/script_tunnel.hpp b/src/script/api/script_tunnel.hpp
index 9911361f7..74fdaabc5 100644
--- a/src/script/api/script_tunnel.hpp
+++ b/src/script/api/script_tunnel.hpp
@@ -85,8 +85,8 @@ public:
* @param start Where to start the tunnel.
* @param vehicle_type The vehicle-type of tunnel to build.
* @pre ScriptMap::IsValidTile(start).
- * @pre vehicle_type == ScriptVehicle::VT_ROAD || (vehicle_type == ScriptVehicle::VT_RAIL &&
- * ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType())).
+ * @pre (vehicle_type == ScriptVehicle::VT_ROAD && ScriptRoad::IsRoadTypeAvailable(ScriptRoad::GetCurrentRoadType())) ||
+ * (vehicle_type == ScriptVehicle::VT_RAIL && ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType())).
* @game @pre Outside CompanyMode: vehicle_type == ScriptVehicle::VT_ROAD.
* @exception ScriptError::ERR_AREA_NOT_CLEAR
* @exception ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER