summaryrefslogtreecommitdiff
path: root/src/station_map.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-05-06 13:05:04 +0000
committerfrosch <frosch@openttd.org>2013-05-06 13:05:04 +0000
commitb9528c3aa01c4d28cf58514e6371db9931ce6400 (patch)
tree8e3165444c0042517eef757f7a978cb823f8a1ec /src/station_map.h
parent02924a1d3e39d0a5d9c417b970cffc2c94118828 (diff)
downloadopenttd-b9528c3aa01c4d28cf58514e6371db9931ce6400.tar.xz
(svn r25221) -Fix: IsCompatibleTrainStationTile() is not a symmetric function. Clarify the parameters and fix the cases were they were swapped.
Diffstat (limited to 'src/station_map.h')
-rw-r--r--src/station_map.h30
1 files changed, 15 insertions, 15 deletions
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);
}
/**