Mercurial > hg > openttd
diff src/train_cmd.cpp @ 17099:b23e23e3904a draft
(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
author | smatz <smatz@openttd.org> |
---|---|
date | Tue, 18 Jan 2011 20:40:36 +0000 (2011-01-18) |
parents | 5035955400bc |
children | 2bf4a68e98fd |
line wrap: on
line diff
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3146,6 +3146,11 @@ 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;