153 static inline bool IsBuoyTile(TileIndex t) |
154 static inline bool IsBuoyTile(TileIndex t) |
154 { |
155 { |
155 return IsTileType(t, MP_STATION) && IsBuoy(t); |
156 return IsTileType(t, MP_STATION) && IsBuoy(t); |
156 } |
157 } |
157 |
158 |
158 static inline bool IsCanalBuoyTile(TileIndex t) |
|
159 { |
|
160 return IsBuoyTile(t) && !IsTileOwner(t, OWNER_WATER); |
|
161 } |
|
162 |
|
163 static inline bool IsSeaBuoyTile(TileIndex t) |
|
164 { |
|
165 return IsBuoyTile(t) && IsTileOwner(t, OWNER_WATER); |
|
166 } |
|
167 |
|
168 static inline bool IsHangarTile(TileIndex t) |
159 static inline bool IsHangarTile(TileIndex t) |
169 { |
160 { |
170 return IsTileType(t, MP_STATION) && IsHangar(t); |
161 return IsTileType(t, MP_STATION) && IsHangar(t); |
171 } |
162 } |
172 |
163 |
188 assert(IsRailwayStationTile(t2)); |
179 assert(IsRailwayStationTile(t2)); |
189 return |
180 return |
190 IsRailwayStationTile(t1) && |
181 IsRailwayStationTile(t1) && |
191 IsCompatibleRail(GetRailType(t1), GetRailType(t2)) && |
182 IsCompatibleRail(GetRailType(t1), GetRailType(t2)) && |
192 GetRailStationAxis(t1) == GetRailStationAxis(t2) && |
183 GetRailStationAxis(t1) == GetRailStationAxis(t2) && |
|
184 GetStationIndex(t1) == GetStationIndex(t2) && |
193 !IsStationTileBlocked(t1); |
185 !IsStationTileBlocked(t1); |
194 } |
186 } |
195 |
187 |
196 |
188 |
197 static inline DiagDirection GetDockDirection(TileIndex t) |
189 static inline DiagDirection GetDockDirection(TileIndex t) |
284 static inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section) |
276 static inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section) |
285 { |
277 { |
286 MakeStation(t, o, sid, STATION_AIRPORT, section); |
278 MakeStation(t, o, sid, STATION_AIRPORT, section); |
287 } |
279 } |
288 |
280 |
289 static inline void MakeBuoy(TileIndex t, StationID sid) |
281 static inline void MakeBuoy(TileIndex t, StationID sid, WaterClass wc) |
290 { |
282 { |
291 /* Make the owner of the buoy tile the same as the current owner of the |
283 /* Make the owner of the buoy tile the same as the current owner of the |
292 * water tile. In this way, we can reset the owner of the water to its |
284 * water tile. In this way, we can reset the owner of the water to its |
293 * original state when the buoy gets removed. */ |
285 * original state when the buoy gets removed. */ |
294 MakeStation(t, GetTileOwner(t), sid, STATION_BUOY, 0); |
286 MakeStation(t, GetTileOwner(t), sid, STATION_BUOY, 0); |
295 } |
287 SetWaterClass(t, wc); |
296 |
288 } |
297 static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d) |
289 |
|
290 static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc) |
298 { |
291 { |
299 MakeStation(t, o, sid, STATION_DOCK, d); |
292 MakeStation(t, o, sid, STATION_DOCK, d); |
300 MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d)); |
293 MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d)); |
|
294 SetWaterClass(t + TileOffsByDiagDir(d), wc); |
301 } |
295 } |
302 |
296 |
303 static inline void MakeOilrig(TileIndex t, StationID sid) |
297 static inline void MakeOilrig(TileIndex t, StationID sid) |
304 { |
298 { |
305 MakeStation(t, OWNER_NONE, sid, STATION_OILRIG, 0); |
299 MakeStation(t, OWNER_NONE, sid, STATION_OILRIG, 0); |