summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2008-11-02 17:42:28 +0000
committermichi_cc <michi_cc@openttd.org>2008-11-02 17:42:28 +0000
commitf649496caafb2946d982dbea84d7232e4fb3f3c9 (patch)
tree353a4af05d0d29df106a02fd720f48f4c1b32b8d /src
parent6d94be75e918aabdefd428abe8f46822f38d842d (diff)
downloadopenttd-f649496caafb2946d982dbea84d7232e4fb3f3c9.tar.xz
(svn r14558) -Fix (r13957): Converting the track type of a tunnel/bridge could cause trains to get stuck.
Diffstat (limited to 'src')
-rw-r--r--src/rail_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index e7c9956ab..3b3621c46 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1393,7 +1393,8 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Track track = DiagDirToDiagTrack(GetTunnelBridgeDirection(tile));
if (GetTunnelBridgeReservation(tile)) {
Vehicle *v = GetTrainForReservation(tile, track);
- if (v != NULL) {
+ if (v != NULL && !HasPowerOnRail(v->u.rail.railtype, totype)) {
+ /* No power on new rail type, reroute. */
FreeTrainTrackReservation(v);
*vehicles_affected.Append() = v;
}