diff --git a/src/station_map.h b/src/station_map.h --- a/src/station_map.h +++ b/src/station_map.h @@ -330,6 +330,78 @@ static inline bool IsHangarTile(Tile t) } /** + * Is tile \a t a blocked tile? + * @pre HasStationRail(t) + * @param t Tile to check + * @return \c true if the tile is blocked + */ +static inline bool IsStationTileBlocked(Tile t) +{ + assert(HasStationRail(t)); + return HasBit(t.m6(), 0); +} + +/** + * Set the blocked state of the rail station + * @pre HasStationRail(t) + * @param t the station tile + * @param b the blocked state + */ +static inline void SetStationTileBlocked(Tile t, bool b) +{ + assert(HasStationRail(t)); + SB(t.m6(), 0, 1, b ? 1 : 0); +} + +/** + * Can tile \a t have catenary wires? + * @pre HasStationRail(t) + * @param t Tile to check + * @return \c true if the tile can have catenary wires + */ +static inline bool CanStationTileHaveWires(Tile t) +{ + assert(HasStationRail(t)); + return HasBit(t.m6(), 6); +} + +/** + * Set the catenary wires state of the rail station + * @pre HasStationRail(t) + * @param t the station tile + * @param b the catenary wires state + */ +static inline void SetStationTileHaveWires(Tile t, bool b) +{ + assert(HasStationRail(t)); + SB(t.m6(), 6, 1, b ? 1 : 0); +} + +/** + * Can tile \a t have catenary pylons? + * @pre HasStationRail(t) + * @param t Tile to check + * @return \c true if the tile can have catenary pylons + */ +static inline bool CanStationTileHavePylons(Tile t) +{ + assert(HasStationRail(t)); + return HasBit(t.m6(), 7); +} + +/** + * Set the catenary pylon state of the rail station + * @pre HasStationRail(t) + * @param t the station tile + * @param b the catenary pylons state + */ +static inline void SetStationTileHavePylons(Tile t, bool b) +{ + assert(HasStationRail(t)); + SB(t.m6(), 7, 1, b ? 1 : 0); +} + +/** * Get the rail direction of a rail station. * @param t Tile to query * @pre HasStationRail(t) @@ -379,10 +451,10 @@ static inline TrackBits GetRailStationTr static inline bool IsCompatibleTrainStationTile(Tile test_tile, Tile station_tile) { assert(IsRailStationTile(station_tile)); - return IsRailStationTile(test_tile) && IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) && + return IsRailStationTile(test_tile) && !IsStationTileBlocked(test_tile) && + IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) && GetRailStationAxis(test_tile) == GetRailStationAxis(station_tile) && - GetStationIndex(test_tile) == GetStationIndex(station_tile) && - !IsStationTileBlocked(test_tile); + GetStationIndex(test_tile) == GetStationIndex(station_tile); } /**