# HG changeset patch # User truelight # Date 1094227397 0 # Node ID 6a72b12f5588e32d23100742ee1531b6d811b461 # Parent d0c8100d18cf6d6b29aaa4fc570e1ae23afa8196 (svn r149) -Fix: [997703] Junction after tunnel bug (blathijs) diff -r d0c8100d18cf -r 6a72b12f5588 pathfind.c --- a/pathfind.c Wed Sep 01 21:54:12 2004 +0000 +++ b/pathfind.c Fri Sep 03 16:03:17 2004 +0000 @@ -594,11 +594,17 @@ restart: if (IS_TILETYPE(tile, MP_TUNNELBRIDGE) && (_map5[tile] & 0xF0)==0) { - if ( (uint)(_map5[tile] & 3) != direction || ((_map5[tile]>>1)&6) != tpf->tracktype) + /* This is a tunnel tile */ + if ( (uint)(_map5[tile] & 3) != (direction ^ 2)) { /* ^ 2 is reversing the direction */ + /* We are not just driving out of the tunnel */ + if ( (uint)(_map5[tile] & 3) != direction || ((_map5[tile]>>1)&6) != tpf->tracktype) + /* We are not driving into the tunnel, or it + * is an invalid tunnel */ goto popnext; - flotr = FindLengthOfTunnel(tile, direction, tpf->tracktype); - si.cur_length += flotr.length; - tile = flotr.tile; + flotr = FindLengthOfTunnel(tile, direction, tpf->tracktype); + si.cur_length += flotr.length; + tile = flotr.tile; + } } // remember the start tile so we know if we're in an inf loop.