summaryrefslogtreecommitdiff
path: root/pathfind.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-09-14 01:21:07 +0000
committerdarkvater <darkvater@openttd.org>2004-09-14 01:21:07 +0000
commitbf703a0e825c16d07cf64f62ace41ff8b9bd69c0 (patch)
treecb5704e43e9954b1ccb64ff71ccd664d49cb0deb /pathfind.c
parent72457bac0dd4d20e98a1f7d537316f34a2ec5844 (diff)
downloadopenttd-bf703a0e825c16d07cf64f62ace41ff8b9bd69c0.tar.xz
(svn r242) -Fix: Pathfinding bug for road vehicles introduced in r160 fixed (blathijs)
-Fix: Pathfinding under bridges bug for ships introduced in r160 fixed (Darkvater)
Diffstat (limited to 'pathfind.c')
-rw-r--r--pathfind.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/pathfind.c b/pathfind.c
index 9a566a273..e5f099ef8 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -212,10 +212,9 @@ FindLengthOfTunnelResult FindLengthOfTunnel(uint tile, int direction)
tile = TILE_FROM_XY(x,y);
if (IS_TILETYPE(tile, MP_TUNNELBRIDGE) &&
- (_map5[tile] & 0xF0) == 0 &&
- //((_map5[tile]>>2)&3) == type && // This is
- //not necesary to check, right?
- ((_map5[tile] & 3)^2) == direction &&
+ (_map5[tile] & 0xF0) == 0 && // tunnel entrance/exit
+ //((_map5[tile]>>2)&3) == type && // rail/road-tunnel <-- This is not necesary to check, right?
+ ((_map5[tile] & 3)^2) == direction && // entrance towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
GetSlopeZ(x+8, y+8) == z)
break;
}
@@ -263,7 +262,7 @@ void TPFMode1(TrackPathFinder *tpf, uint tile, int direction)
uint tile_org = tile;
if (IS_TILETYPE(tile, MP_TUNNELBRIDGE) && (_map5[tile] & 0xF0)==0) {
- if ((_map5[tile] & 3) != direction || ((_map5[tile]>>1)&6) != tpf->tracktype)
+ if ((_map5[tile] & 3) != direction || ((_map5[tile]>>2)&3) != tpf->tracktype)
return;
tile = SkipToEndOfTunnel(tpf, tile, direction);
}