23 LOCK_END = 0x1C |
23 LOCK_END = 0x1C |
24 } LockPart; |
24 } LockPart; |
25 |
25 |
26 static inline WaterTileType GetWaterTileType(TileIndex t) |
26 static inline WaterTileType GetWaterTileType(TileIndex t) |
27 { |
27 { |
28 if (_m[t].m5 == 0) return WATER_CLEAR; |
28 if (_m[t].m5 == 0) return WATER_TILE_CLEAR; |
29 if (_m[t].m5 == 1) return WATER_COAST; |
29 if (_m[t].m5 == 1) return WATER_TILE_COAST; |
30 if (IS_INT_INSIDE(_m[t].m5, LOCK_MIDDLE, LOCK_END)) return WATER_LOCK; |
30 if (IS_INT_INSIDE(_m[t].m5, LOCK_MIDDLE, LOCK_END)) return WATER_TILE_LOCK; |
31 |
31 |
32 assert(IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END)); |
32 assert(IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END)); |
33 return WATER_DEPOT; |
33 return WATER_TILE_DEPOT; |
34 } |
34 } |
35 |
35 |
36 static inline bool IsWater(TileIndex t) |
36 static inline bool IsWater(TileIndex t) |
37 { |
37 { |
38 return GetWaterTileType(t) == WATER_CLEAR; |
38 return GetWaterTileType(t) == WATER_TILE_CLEAR; |
39 } |
39 } |
40 |
40 |
41 static inline bool IsCoast(TileIndex t) |
41 static inline bool IsCoast(TileIndex t) |
42 { |
42 { |
43 return GetWaterTileType(t) == WATER_COAST; |
43 return GetWaterTileType(t) == WATER_TILE_COAST; |
44 } |
44 } |
45 |
45 |
46 static inline bool IsClearWaterTile(TileIndex t) |
46 static inline bool IsClearWaterTile(TileIndex t) |
47 { |
47 { |
48 return IsTileType(t, MP_WATER) && IsWater(t) && GetTileSlope(t, NULL) == SLOPE_FLAT; |
48 return IsTileType(t, MP_WATER) && IsWater(t) && GetTileSlope(t, NULL) == SLOPE_FLAT; |
73 return (DiagDirection)GB(_m[t].m5, 0, 2); |
73 return (DiagDirection)GB(_m[t].m5, 0, 2); |
74 } |
74 } |
75 |
75 |
76 static inline byte GetSection(TileIndex t) |
76 static inline byte GetSection(TileIndex t) |
77 { |
77 { |
78 assert(GetWaterTileType(t) == WATER_LOCK || GetWaterTileType(t) == WATER_DEPOT); |
78 assert(GetWaterTileType(t) == WATER_TILE_LOCK || GetWaterTileType(t) == WATER_TILE_DEPOT); |
79 return GB(_m[t].m5, 0, 4); |
79 return GB(_m[t].m5, 0, 4); |
80 } |
80 } |
81 |
81 |
82 |
82 |
83 static inline void MakeWater(TileIndex t) |
83 static inline void MakeWater(TileIndex t) |