(svn r14558) -Fix (r13957): Converting the track type of a tunnel/bridge could cause trains to get stuck.
authormichi_cc
Sun, 02 Nov 2008 17:42:28 +0000
changeset 10313 57bba78128d2
parent 10312 3c14d0ea0ef5
child 10314 ac0958307f68
(svn r14558) -Fix (r13957): Converting the track type of a tunnel/bridge could cause trains to get stuck.
src/rail_cmd.cpp
--- a/src/rail_cmd.cpp	Sun Nov 02 11:41:13 2008 +0000
+++ b/src/rail_cmd.cpp	Sun Nov 02 17:42:28 2008 +0000
@@ -1393,7 +1393,8 @@
 						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;
 							}