summaryrefslogtreecommitdiff
path: root/src/script/api/script_tile.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-04-06 07:46:15 +0100
committerMichael Lutz <michi@icosahedron.de>2019-05-01 21:36:27 +0200
commitc02ef3e4564b7b54d49f0827d2d7625cbc38f335 (patch)
tree1c0ee62b6ce55124b247daaafa42300bfaa932e7 /src/script/api/script_tile.cpp
parent21edf67f89c60351d5a0d84625455aa296b6b950 (diff)
downloadopenttd-c02ef3e4564b7b54d49f0827d2d7625cbc38f335.tar.xz
Feature: Add NotRoadTypes (NRT)
Diffstat (limited to 'src/script/api/script_tile.cpp')
-rw-r--r--src/script/api/script_tile.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp
index 136461762..3d10b7d51 100644
--- a/src/script/api/script_tile.cpp
+++ b/src/script/api/script_tile.cpp
@@ -33,12 +33,12 @@
case MP_WATER: return IsCoast(tile);
case MP_ROAD:
/* Tram bits aren't considered buildable */
- if (::GetRoadTypes(tile) != ROADTYPES_ROAD) return false;
+ if (::GetRoadTypeTram(tile) != INVALID_ROADTYPE) return false;
/* Depots and crossings aren't considered buildable */
if (::GetRoadTileType(tile) != ROAD_TILE_NORMAL) return false;
- if (!HasExactlyOneBit(::GetRoadBits(tile, ROADTYPE_ROAD))) return false;
- if (::IsRoadOwner(tile, ROADTYPE_ROAD, OWNER_TOWN)) return true;
- if (::IsRoadOwner(tile, ROADTYPE_ROAD, ScriptObject::GetCompany())) return true;
+ if (!HasExactlyOneBit(::GetRoadBits(tile, RTT_ROAD))) return false;
+ if (::IsRoadOwner(tile, RTT_ROAD, OWNER_TOWN)) return true;
+ if (::IsRoadOwner(tile, RTT_ROAD, ScriptObject::GetCompany())) return true;
return false;
}
}
@@ -201,7 +201,12 @@
{
if (!::IsValidTile(tile)) return false;
- return ::TrackStatusToTrackdirBits(::GetTileTrackStatus(tile, (::TransportType)transport_type, UINT32_MAX)) != TRACKDIR_BIT_NONE;
+ if (transport_type == TRANSPORT_ROAD) {
+ return ::TrackStatusToTrackdirBits(::GetTileTrackStatus(tile, (::TransportType)transport_type, 0)) != TRACKDIR_BIT_NONE ||
+ ::TrackStatusToTrackdirBits(::GetTileTrackStatus(tile, (::TransportType)transport_type, 1)) != TRACKDIR_BIT_NONE;
+ } else {
+ return ::TrackStatusToTrackdirBits(::GetTileTrackStatus(tile, (::TransportType)transport_type, 0)) != TRACKDIR_BIT_NONE;
+ }
}
/* static */ int32 ScriptTile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius)