summaryrefslogtreecommitdiff
path: root/rail.c
diff options
context:
space:
mode:
Diffstat (limited to 'rail.c')
-rw-r--r--rail.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/rail.c b/rail.c
index aa2865cb3..5b6650667 100644
--- a/rail.c
+++ b/rail.c
@@ -104,6 +104,7 @@ const Trackdir _dir_to_diag_trackdir[] = {
RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
{
+ DiagDirection exitdir = TrackdirToExitdir(trackdir);
switch (GetTileType(tile)) {
case MP_RAILWAY:
return GetRailType(tile);
@@ -123,8 +124,21 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
return GetRailType(tile);
}
} else {
- if (GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
- return GetRailType(tile);
+ if (IsBridgeRamp(tile)) {
+ if (GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
+ return GetRailType(tile);
+ }
+ } else {
+ if (GetBridgeAxis(tile) == DiagDirToAxis(exitdir)) {
+ if (GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
+ return GetRailTypeOnBridge(tile);
+ }
+ } else {
+ if (IsTransportUnderBridge(tile) &&
+ GetTransportTypeUnderBridge(tile) == TRANSPORT_RAIL) {
+ return GetRailType(tile);
+ }
+ }
}
}
break;