188 static inline TrackBits GetCrossingRailBits(TileIndex tile) |
189 static inline TrackBits GetCrossingRailBits(TileIndex tile) |
189 { |
190 { |
190 return AxisToTrackBits(OtherAxis(GetCrossingRoadAxis(tile))); |
191 return AxisToTrackBits(OtherAxis(GetCrossingRoadAxis(tile))); |
191 } |
192 } |
192 |
193 |
193 |
|
194 static inline void UnbarCrossing(TileIndex t) |
|
195 { |
|
196 assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
|
197 ClrBit(_m[t].m4, 5); |
|
198 } |
|
199 |
|
200 static inline void BarCrossing(TileIndex t) |
|
201 { |
|
202 assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
|
203 SetBit(_m[t].m4, 5); |
|
204 } |
|
205 |
|
206 static inline bool IsCrossingBarred(TileIndex t) |
194 static inline bool IsCrossingBarred(TileIndex t) |
207 { |
195 { |
208 assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
196 assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
209 return HasBit(_m[t].m4, 5); |
197 return HasBit(_m[t].m4, 5); |
|
198 } |
|
199 |
|
200 static inline void SetCrossingBarred(TileIndex t, bool barred) |
|
201 { |
|
202 assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
|
203 SB(_m[t].m4, 5, 1, barred); |
|
204 } |
|
205 |
|
206 static inline void UnbarCrossing(TileIndex t) |
|
207 { |
|
208 SetCrossingBarred(t, false); |
|
209 } |
|
210 |
|
211 static inline void BarCrossing(TileIndex t) |
|
212 { |
|
213 SetCrossingBarred(t, true); |
210 } |
214 } |
211 |
215 |
212 #define IsOnDesert IsOnSnow |
216 #define IsOnDesert IsOnSnow |
213 static inline bool IsOnSnow(TileIndex t) |
217 static inline bool IsOnSnow(TileIndex t) |
214 { |
218 { |
302 * @param tile the tile to get the track bits for |
306 * @param tile the tile to get the track bits for |
303 * @return the track bits for the given tile |
307 * @return the track bits for the given tile |
304 */ |
308 */ |
305 TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt); |
309 TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt); |
306 |
310 |
|
311 /** |
|
312 * Return if the tile is a valid tile for a crossing. |
|
313 * |
|
314 * @note function is overloaded |
|
315 * @param tile the curent tile |
|
316 * @param ax the axis of the road over the rail |
|
317 * @return true if it is a valid tile |
|
318 */ |
|
319 bool IsPossibleCrossing(const TileIndex tile, Axis ax); |
|
320 |
307 |
321 |
308 static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram, Owner hway) |
322 static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram, Owner hway) |
309 { |
323 { |
310 SetTileType(t, MP_ROAD); |
324 SetTileType(t, MP_ROAD); |
311 SetTileOwner(t, road); |
325 SetTileOwner(t, road); |