summaryrefslogtreecommitdiff
path: root/station_map.h
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-04 11:35:52 +0000
committercelestar <celestar@openttd.org>2006-04-04 11:35:52 +0000
commit715bee332be63de4a2a89a2168d8f60c911ffdb6 (patch)
treee6e0b22a7932338beafa21c661c109ec9a1de75b /station_map.h
parentb7ee0b8ba34e026fd7298ad2bb9a6d6ed3267d0b (diff)
downloadopenttd-715bee332be63de4a2a89a2168d8f60c911ffdb6.tar.xz
(svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
Diffstat (limited to 'station_map.h')
-rw-r--r--station_map.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/station_map.h b/station_map.h
index e0ed3def0..c60a69b39 100644
--- a/station_map.h
+++ b/station_map.h
@@ -71,6 +71,20 @@ static inline bool IsRailwayStation(TileIndex t)
return _m[t].m5 < RAILWAY_BASE + RAILWAY_SIZE;
}
+static inline bool IsRailwayStationTile(TileIndex t)
+{
+ return IsTileType(t, MP_STATION) && IsRailwayStation(t);
+}
+
+static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2)
+{
+ assert(IsRailwayStationTile(t2));
+ return
+ IsRailwayStationTile(t1) &&
+ GB(_m[t1].m3, 0, 4) == GB(_m[t2].m3, 0, 4) && // same rail type?
+ GB(_m[t1].m5, 0, 1) == GB(_m[t2].m5, 0, 1); // same direction?
+}
+
static inline bool IsHangar(TileIndex t)
{
assert(IsTileType(t, MP_STATION));
@@ -137,6 +151,11 @@ static inline bool IsBuoy_(TileIndex t) // XXX _ due to naming conflict
return _m[t].m5 == BUOY_BASE;
}
+static inline bool IsBuoyTile(TileIndex t)
+{
+ return IsTileType(t, MP_STATION) && IsBuoy_(t);
+}
+
static inline bool IsHangarTile(TileIndex t)
{