diff options
Diffstat (limited to 'bridge_map.h')
-rw-r--r-- | bridge_map.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bridge_map.h b/bridge_map.h index ba8e71d50..f1e12db59 100644 --- a/bridge_map.h +++ b/bridge_map.h @@ -3,12 +3,25 @@ #ifndef BRIDGE_MAP_H #define BRIDGE_MAP_H +#include "direction.h" #include "macros.h" #include "map.h" #include "rail.h" #include "tile.h" +/** + * Get the direction pointing onto the bridge + */ +static inline DiagDirection GetBridgeRampDirection(TileIndex t) +{ + /* Heavy wizardry to convert the X/Y (bit 0) + N/S (bit 5) encoding of + * bridges to a DiagDirection + */ + return (DiagDirection)((6 - (_m[t].m5 >> 4 & 2) - (_m[t].m5 & 1)) % 4); +} + + static inline void SetClearUnderBridge(TileIndex t) { SetTileOwner(t, OWNER_NONE); |