summaryrefslogtreecommitdiff
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
commit297392f3fabdb03b0d6c502d42b6b73a014c550b (patch)
tree353a4af05d0d29df106a02fd720f48f4c1b32b8d
parent609a635facb6f07a2fc510304b2163cda41286bb (diff)
downloadopenttd-297392f3fabdb03b0d6c502d42b6b73a014c550b.tar.xz
(svn r14558) -Fix (r13957): Converting the track type of a tunnel/bridge could cause trains to get stuck.
-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;
}