tron@3154: /* $Id$ */ tron@3154: tron@3154: #ifndef TUNNEL_MAP_H tron@3154: #define TUNNEL_MAP_H tron@3154: tron@3154: #include "direction.h" tron@3154: #include "macros.h" tron@3154: #include "map.h" tron@3154: #include "rail.h" tron@3154: celestar@5591: static inline bool IsTunnelTile(TileIndex t) tron@3184: { celestar@5590: return IsTileType(t, MP_TUNNEL); tron@3184: } tron@3184: tron@3154: static inline DiagDirection GetTunnelDirection(TileIndex t) tron@3154: { tron@3369: assert(IsTunnelTile(t)); tron@3154: return (DiagDirection)GB(_m[t].m5, 0, 2); tron@3154: } tron@3154: tron@3154: tron@3154: static inline TransportType GetTunnelTransportType(TileIndex t) tron@3154: { tron@3369: assert(IsTunnelTile(t)); tron@3154: return (TransportType)GB(_m[t].m5, 2, 2); tron@3154: } tron@3154: celestar@5592: static inline bool HasTunnelSnowOrDesert(TileIndex t) celestar@5592: { celestar@5592: assert(IsTunnelTile(t)); celestar@5592: return HASBIT(_m[t].m4, 7); celestar@5592: } celestar@5592: celestar@5592: static inline void SetTunnelSnowOrDesert(TileIndex t, bool snow_or_desert) celestar@5592: { celestar@5592: assert(IsTunnelTile(t)); celestar@5592: SB(_m[t].m4, 7, 1, snow_or_desert); celestar@5592: } celestar@5592: tron@3154: tron@3154: TileIndex GetOtherTunnelEnd(TileIndex); tron@3156: bool IsTunnelInWay(TileIndex, uint z); tron@3154: tron@3154: tron@3154: static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d) tron@3154: { celestar@5590: SetTileType(t, MP_TUNNEL); tron@3154: SetTileOwner(t, o); tron@3154: _m[t].m2 = 0; tron@3154: _m[t].m3 = 0; tron@3154: _m[t].m4 = 0; tron@3154: _m[t].m5 = TRANSPORT_ROAD << 2 | d; tron@3154: } tron@3154: tron@3154: static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) tron@3154: { celestar@5590: SetTileType(t, MP_TUNNEL); tron@3154: SetTileOwner(t, o); tron@3154: _m[t].m2 = 0; tron@3154: _m[t].m3 = r; tron@3154: _m[t].m4 = 0; tron@3154: _m[t].m5 = TRANSPORT_RAIL << 2 | d; tron@3154: } tron@3154: peter1138@4666: #endif /* TUNNEL_MAP_H */