From b9528c3aa01c4d28cf58514e6371db9931ce6400 Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 6 May 2013 13:05:04 +0000 Subject: (svn r25221) -Fix: IsCompatibleTrainStationTile() is not a symmetric function. Clarify the parameters and fix the cases were they were swapped. --- src/station_map.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/station_map.h') diff --git a/src/station_map.h b/src/station_map.h index 1411a7833..67f41f1d7 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -364,25 +364,25 @@ static inline TrackBits GetRailStationTrackBits(TileIndex t) } /** - * Check if tile is compatible with a railstation tile. The two tiles - * are compatible if all of the following are true: - * \li both tiles are rail station tiles - * \li the railtype of \a t1 is compatible with the railtype of \a t2 - * \li the tracks on \a t1 and \a t2 are in the same direction + * Check if a tile is a valid continuation to a railstation tile. + * The tile \a test_tile is a valid continuation to \a station_tile, if all of the following are true: + * \li \a test_tile is a rail station tile + * \li the railtype of \a test_tile is compatible with the railtype of \a station_tile + * \li the tracks on \a test_tile and \a station_tile are in the same direction * \li both tiles belong to the same station - * \li \a t1 is not blocked (@see IsStationTileBlocked) - * @param t1 First tile to compare - * @param t2 Second tile to compare - * @pre IsRailStationTile(t2) + * \li \a test_tile is not blocked (@see IsStationTileBlocked) + * @param test_tile Tile to test + * @param station_tile Station tile to compare with + * @pre IsRailStationTile(station_tile) * @return true if the two tiles are compatible */ -static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2) +static inline bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex station_tile) { - assert(IsRailStationTile(t2)); - return IsRailStationTile(t1) && IsCompatibleRail(GetRailType(t1), GetRailType(t2)) && - GetRailStationAxis(t1) == GetRailStationAxis(t2) && - GetStationIndex(t1) == GetStationIndex(t2) && - !IsStationTileBlocked(t1); + assert(IsRailStationTile(station_tile)); + return IsRailStationTile(test_tile) && IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) && + GetRailStationAxis(test_tile) == GetRailStationAxis(station_tile) && + GetStationIndex(test_tile) == GetStationIndex(station_tile) && + !IsStationTileBlocked(test_tile); } /** -- cgit v1.2.3-54-g00ecf