summaryrefslogtreecommitdiff
path: root/rail.h
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-07-03 13:02:54 +0000
committermatthijs <matthijs@openttd.org>2005-07-03 13:02:54 +0000
commitfb8e5f61b181ca34c43d0a0e8d39ee95af2eb60a (patch)
tree6d371024326a8ed726a5b94394047c888bd1a2c8 /rail.h
parent6df35235d5b610262af8777cf2047245d271e5c9 (diff)
downloadopenttd-fb8e5f61b181ca34c43d0a0e8d39ee95af2eb60a.tar.xz
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
- Codechange: [NPF] Check the railtype along a route against the engine type instead of against the previouse tile. This clears the way for electriefied rails. - Add: [NPF] [ 1209644 ] A penalty for crossings (peter1138)
Diffstat (limited to 'rail.h')
-rw-r--r--rail.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/rail.h b/rail.h
index 4152a406f..323e0f983 100644
--- a/rail.h
+++ b/rail.h
@@ -441,7 +441,7 @@ static inline bool HasSemaphores(TileIndex tile, Track track)
* The given trackdir is used when there are (could be) multiple rail types on
* one tile.
*/
-RailType GetTileRailType(TileIndex tile, byte trackdir);
+RailType GetTileRailType(TileIndex tile, Trackdir trackdir);
/**
* Returns whether the given tile is a level crossing.
@@ -472,4 +472,17 @@ static inline TransportType GetCrossingTransportType(TileIndex tile, Track track
return INVALID_TRANSPORT;
}
+/**
+ * Checks if an engine of the given RailType can drive on a tile with a given
+ * RailType. This would normally just be an equality check, but for electric
+ * rails (which also support non-electric engines).
+ * @return Whether the engine can drive on this tile.
+ * @param enginetype The RailType of the engine we are considering.
+ * @param tiletype The RailType of the tile we are considering.
+ */
+static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype)
+{
+ return enginetype == tiletype;
+}
+
#endif // RAIL_H