summaryrefslogtreecommitdiff
path: root/road_map.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-05 12:22:20 +0000
committertron <tron@openttd.org>2006-03-05 12:22:20 +0000
commit4da99989b9b1420d95756cb981663c3e49f481fb (patch)
treec60df54ca959b2f8cbb49252a82727e5496e5f5f /road_map.h
parent62abd9c1e288a8cd3154245fef9ec48d76a85135 (diff)
downloadopenttd-4da99989b9b1420d95756cb981663c3e49f481fb.tar.xz
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
Diffstat (limited to 'road_map.h')
-rw-r--r--road_map.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/road_map.h b/road_map.h
index ec9cd33cc..120688474 100644
--- a/road_map.h
+++ b/road_map.h
@@ -22,6 +22,12 @@ static inline RoadBits ComplementRoadBits(RoadBits r)
return ROAD_ALL ^ r;
}
+static inline RoadBits DiagDirToRoadBits(DiagDirection d)
+{
+ return 1 << (3 ^ d);
+}
+
+
static inline RoadBits GetRoadBits(TileIndex tile)
{
return GB(_m[tile].m5, 0, 4);
@@ -50,6 +56,17 @@ static inline RoadType GetRoadType(TileIndex tile)
}
+/**
+ * Returns the RoadBits on an arbitrary tile
+ * Special behavior:
+ * - road depots: entrance is treated as road piece
+ * - road tunnels: entrance is treated as road piece
+ * - bridge ramps: treated as straight road
+ * - bridge middle parts: bridge itself is ignored
+ */
+RoadBits GetAnyRoadBits(TileIndex);
+
+
static inline void MakeRoadNormal(TileIndex t, Owner owner, RoadBits bits, uint town)
{
SetTileType(t, MP_STREET);