202 GetRailStationAxis(t1) == GetRailStationAxis(t2) && |
202 GetRailStationAxis(t1) == GetRailStationAxis(t2) && |
203 GetStationIndex(t1) == GetStationIndex(t2) && |
203 GetStationIndex(t1) == GetStationIndex(t2) && |
204 !IsStationTileBlocked(t1); |
204 !IsStationTileBlocked(t1); |
205 } |
205 } |
206 |
206 |
|
207 /** |
|
208 * Get the reservation state of the rail station |
|
209 * @pre IsRailwayStationTile(t) |
|
210 * @param t the station tile |
|
211 * @return reservation state |
|
212 */ |
|
213 static inline bool GetRailwayStationReservation(TileIndex t) |
|
214 { |
|
215 assert(IsRailwayStationTile(t)); |
|
216 return HasBit(_m[t].m6, 2); |
|
217 } |
|
218 |
|
219 /** |
|
220 * Set the reservation state of the rail station |
|
221 * @pre IsRailwayStationTile(t) |
|
222 * @param t the station tile |
|
223 * @param b the reservation state |
|
224 */ |
|
225 static inline void SetRailwayStationReservation(TileIndex t, bool b) |
|
226 { |
|
227 assert(IsRailwayStationTile(t)); |
|
228 SB(_m[t].m6, 2, 1, b ? 1 : 0); |
|
229 } |
|
230 |
|
231 /** |
|
232 * Get the reserved track bits for a waypoint |
|
233 * @pre IsRailwayStationTile(t) |
|
234 * @param t the tile |
|
235 * @return reserved track bits |
|
236 */ |
|
237 static inline TrackBits GetRailStationReservation(TileIndex t) |
|
238 { |
|
239 return GetRailwayStationReservation(t) ? AxisToTrackBits(GetRailStationAxis(t)) : TRACK_BIT_NONE; |
|
240 } |
|
241 |
207 |
242 |
208 static inline DiagDirection GetDockDirection(TileIndex t) |
243 static inline DiagDirection GetDockDirection(TileIndex t) |
209 { |
244 { |
210 StationGfx gfx = GetStationGfx(t); |
245 StationGfx gfx = GetStationGfx(t); |
211 assert(IsDock(t) && gfx < GFX_DOCK_BASE_WATER_PART); |
246 assert(IsDock(t) && gfx < GFX_DOCK_BASE_WATER_PART); |
275 |
310 |
276 static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt) |
311 static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt) |
277 { |
312 { |
278 MakeStation(t, o, sid, STATION_RAIL, section + a); |
313 MakeStation(t, o, sid, STATION_RAIL, section + a); |
279 SetRailType(t, rt); |
314 SetRailType(t, rt); |
|
315 SetRailwayStationReservation(t, false); |
280 } |
316 } |
281 |
317 |
282 static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, DiagDirection d) |
318 static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, DiagDirection d) |
283 { |
319 { |
284 MakeStation(t, o, sid, (rst == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), d); |
320 MakeStation(t, o, sid, (rst == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), d); |