summaryrefslogtreecommitdiff
path: root/src/newgrf_station.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-07-19 10:10:21 +0000
committerrubidium <rubidium@openttd.org>2008-07-19 10:10:21 +0000
commitbfa66f70b3b074ec098431cd2084143a18348568 (patch)
treeab80c285247fe78d45c50fe1f0832c82b34c4d8b /src/newgrf_station.cpp
parentf2da04573105942c4c6dc6e64e65281acb596850 (diff)
downloadopenttd-bfa66f70b3b074ec098431cd2084143a18348568.tar.xz
(svn r13734) -Fix: NewGRF rail continuation would always mark a tunnel on the same axis as connected, even when the tunnel faces the wrong direction.
Diffstat (limited to 'src/newgrf_station.cpp')
-rw-r--r--src/newgrf_station.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 4f57699ab..6a978ac63 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -25,6 +25,7 @@
#include "player_func.h"
#include "animated_tile_func.h"
#include "functions.h"
+#include "tunnelbridge_map.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -294,11 +295,18 @@ static uint32 GetRailContinuationInfo(TileIndex tile)
uint i;
for (i = 0; i < lengthof(x_dir); i++, dir++, diagdir++) {
- TrackBits trackbits = TrackStatusToTrackBits(GetTileTrackStatus(tile + TileOffsByDir(*dir), TRANSPORT_RAIL, 0));
+ TileIndex neighbour_tile = tile + TileOffsByDir(*dir);
+ TrackBits trackbits = TrackStatusToTrackBits(GetTileTrackStatus(neighbour_tile, TRANSPORT_RAIL, 0));
if (trackbits != TRACK_BIT_NONE) {
/* If there is any track on the tile, set the bit in the second byte */
SetBit(res, i + 8);
+ /* With tunnels and bridges the tile has tracks, but they are not necessarily connected
+ * with the next tile because the ramp is not going in the right direction. */
+ if (IsTileType(neighbour_tile, MP_TUNNELBRIDGE) && GetTunnelBridgeDirection(neighbour_tile) != *diagdir) {
+ continue;
+ }
+
/* If any track reaches our exit direction, set the bit in the lower byte */
if (trackbits & DiagdirReachesTracks(*diagdir)) SetBit(res, i);
}