Changeset - r14722:03625b46a399
[Not reviewed]
master
0 1 0
alberth - 15 years ago 2010-03-05 21:34:12
alberth@openttd.org
(svn r19320) -Fix (r19291): Forgot to set error message.
1 file changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -1469,26 +1469,29 @@ CommandCost CmdConvertRail(TileIndex til
 
					}
 
					break;
 

	
 
				case MP_TUNNELBRIDGE: {
 
					TileIndex endtile = GetOtherTunnelBridgeEnd(tile);
 

	
 
					/* If both ends of tunnel/bridge are in the range, do not try to convert twice -
 
					 * it would cause assert because of different test and exec runs */
 
					if (endtile < tile && TileX(endtile) >= sx && TileX(endtile) <= ex &&
 
							TileY(endtile) >= sy && TileY(endtile) <= ey) continue;
 

	
 
					/* When not coverting rail <-> el. rail, any vehicle cannot be in tunnel/bridge */
 
					if (!IsCompatibleRail(GetRailType(tile), totype) &&
 
							TunnelBridgeIsFree(tile, endtile).Failed()) continue;
 
					if (!IsCompatibleRail(GetRailType(tile), totype)) {
 
						CommandCost ret = TunnelBridgeIsFree(tile, endtile);
 
						ret.SetGlobalErrorMessage();
 
						if (ret.Failed()) continue;
 
					}
 

	
 
					if (flags & DC_EXEC) {
 
						Track track = DiagDirToDiagTrack(GetTunnelBridgeDirection(tile));
 
						if (HasTunnelBridgeReservation(tile)) {
 
							Train *v = GetTrainForReservation(tile, track);
 
							if (v != NULL && !HasPowerOnRail(v->railtype, totype)) {
 
								/* No power on new rail type, reroute. */
 
								FreeTrainTrackReservation(v);
 
								*vehicles_affected.Append() = v;
 
							}
 
						}
 
						SetRailType(tile, totype);
0 comments (0 inline, 0 general)