summaryrefslogtreecommitdiff
path: root/station.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-04-12 10:31:26 +0000
committertron <tron@openttd.org>2005-04-12 10:31:26 +0000
commit02f581891243a9f16562f48a3a5ea544f0df94a1 (patch)
treebe6e75493ba88f6d4885bd8228137a4c769d583f /station.h
parent277d9d237b4cf1f18bfffa7899e63fbdf296c80d (diff)
downloadopenttd-02f581891243a9f16562f48a3a5ea544f0df94a1.tar.xz
(svn r2189) Introduce and use IsCompatibleTrainStationTile()
This should prevent trains, which are longer than the station, to turn around without stopping under certain circumstances and fix speed limit for trains entering a station, when realistic accerlation is used
Diffstat (limited to 'station.h')
-rw-r--r--station.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/station.h b/station.h
index f76eda227..2ac2e5403 100644
--- a/station.h
+++ b/station.h
@@ -276,6 +276,15 @@ static inline bool IsTrainStationTile(uint tile) {
return IsTileType(tile, MP_STATION) && IS_BYTE_INSIDE(_map5[tile], 0, 8);
}
+static inline bool IsCompatibleTrainStationTile(TileIndex tile, TileIndex ref)
+{
+ assert(IsTrainStationTile(ref));
+ return
+ IsTrainStationTile(tile) &&
+ (_map3_lo[tile] & 0x0F) == (_map3_lo[ref] & 0x0F) && // same rail type?
+ (_map5[tile] & 0x01) == (_map5[ref] & 0x01); // same direction?
+}
+
static inline bool IsRoadStationTile(uint tile) {
return IsTileType(tile, MP_STATION) && IS_BYTE_INSIDE(_map5[tile], 0x43, 0x4B);
}