diff options
author | tron <tron@openttd.org> | 2006-03-16 15:16:27 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-16 15:16:27 +0000 |
commit | b8da06ddb11f234451864e0b454163ebb546e4cd (patch) | |
tree | 79a0e9518fd43cbe914bddcaebf4983201598bc8 /bridge_map.h | |
parent | d6134455a5aaa7b247545886be573a555cdfc2be (diff) | |
download | openttd-b8da06ddb11f234451864e0b454163ebb546e4cd.tar.xz |
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
Diffstat (limited to 'bridge_map.h')
-rw-r--r-- | bridge_map.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bridge_map.h b/bridge_map.h index bbb443615..f799077b3 100644 --- a/bridge_map.h +++ b/bridge_map.h @@ -7,9 +7,21 @@ #include "macros.h" #include "map.h" #include "rail.h" +#include "road_map.h" #include "tile.h" +static inline bool IsBridge(TileIndex t) +{ + return HASBIT(_m[t].m5, 7); +} + +static inline bool IsBridgeTile(TileIndex t) +{ + return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t); +} + + static inline bool IsBridgeRamp(TileIndex t) { return !HASBIT(_m[t].m5, 6); @@ -61,6 +73,12 @@ static inline Axis GetBridgeAxis(TileIndex t) } +static inline TransportType GetBridgeTransportType(TileIndex t) +{ + return (TransportType)GB(_m[t].m5, 1, 2); +} + + static inline bool IsClearUnderBridge(TileIndex t) { return GB(_m[t].m5, 3, 3) == 0; @@ -82,6 +100,16 @@ static inline TransportType GetTransportTypeUnderBridge(TileIndex t) return (TransportType)GB(_m[t].m5, 3, 2); } +static inline RoadBits GetRoadBitsUnderBridge(TileIndex t) +{ + return GetBridgeAxis(t) == AXIS_X ? ROAD_Y : ROAD_X; +} + +static inline TrackBits GetRailBitsUnderBridge(TileIndex t) +{ + return GetBridgeAxis(t) == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X; +} + /** * Finds the end of a bridge in the specified direction starting at a middle tile |