diff options
author | smatz <smatz@openttd.org> | 2011-01-18 20:40:36 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2011-01-18 20:40:36 +0000 |
commit | c0b051eb33821b5ea698149346921ae8b1122f59 (patch) | |
tree | d82339fa6ab50a7d6cb43d1a76fce62b6716ba6b | |
parent | 772de6b52d275831c1244adf869f33e2ae464fa8 (diff) | |
download | openttd-c0b051eb33821b5ea698149346921ae8b1122f59.tar.xz |
(svn r21836) -Fix: when a train was reversed while inside a tunnel/bridge, it wouldn't have (re)set the GOINGUP/DOWN bits after leaving the tunnel/bridge
-rw-r--r-- | src/train_cmd.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index a96d87b25..93d91f4c3 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3146,6 +3146,11 @@ static void TrainController(Train *v, Vehicle *nomove) TryReserveRailTrack(gp.new_tile, DiagDirToDiagTrack(GetTunnelBridgeDirection(gp.new_tile))); CheckNextTrainTile(v); } + /* Prevent v->UpdateInclination() being called with wrong parameters. + * This could happen if the train was reversed inside the tunnel/bridge. */ + if (gp.old_tile == gp.new_tile) { + gp.old_tile = GetOtherTunnelBridgeEnd(gp.old_tile); + } } else { v->x_pos = gp.x; v->y_pos = gp.y; |