summaryrefslogtreecommitdiff
path: root/rail.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-07-09 13:45:21 +0000
committermatthijs <matthijs@openttd.org>2005-07-09 13:45:21 +0000
commitff0383dacec448b8089305cf0a64c6c1196fff8f (patch)
treebb6fc7c1dfd9efac7808d00c7e9fbcd95aa371eb /rail.c
parent418e032fac9b8f6d08da95fe15d6afe9484be231 (diff)
downloadopenttd-ff0383dacec448b8089305cf0a64c6c1196fff8f.tar.xz
(svn r2539) * Fix: Mixed up use of trackdirs and directions in GetTileRailType() causes NPF to not consider routes under bridges.
Diffstat (limited to 'rail.c')
-rw-r--r--rail.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rail.c b/rail.c
index ecd6be937..5952dae57 100644
--- a/rail.c
+++ b/rail.c
@@ -109,6 +109,7 @@ const Trackdir _reverse_trackdir[] = {
RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
{
RailType type = INVALID_RAILTYPE;
+ DiagDirection exitdir = TrackdirToExitdir(trackdir);
switch (GetTileType(tile)) {
case MP_RAILWAY:
/* railway track */
@@ -129,10 +130,10 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
/* railway bridge ending */
if ((_map5[tile] & 0xC6) == 0x80) type = _map3_lo[tile] & RAILTYPE_MASK;
/* on railway bridge */
- if ((_map5[tile] & 0xC6) == 0xC0 && ((DiagDirection)(_map5[tile] & 0x1)) == (TrackdirToExitdir(trackdir) & 0x1))
+ if ((_map5[tile] & 0xC6) == 0xC0 && ((DiagDirection)(_map5[tile] & 0x1)) == (exitdir & 0x1))
type = (_map3_lo[tile] >> 4) & RAILTYPE_MASK;
/* under bridge (any type) */
- if ((_map5[tile] & 0xC0) == 0xC0 && ((uint)_map5[tile] & 0x1) != (trackdir & 0x1))
+ if ((_map5[tile] & 0xC0) == 0xC0 && ((uint)_map5[tile] & 0x1) != (exitdir & 0x1))
type = _map3_lo[tile] & RAILTYPE_MASK;
break;
default: