Changeset - r15567:32b05d4fb552
[Not reviewed]
master
0 1 0
michi_cc - 14 years ago 2010-07-28 22:23:28
michi_cc@openttd.org
(svn r20237) -Fix (r20049): Check for disallowed level crossings also when converting rail.
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -1408,24 +1408,28 @@ CommandCost CmdConvertRail(TileIndex til
 
			TileIndex tile = TileXY(x, y);
 
			TileType tt = GetTileType(tile);
 

	
 
			/* Check if there is any track on tile */
 
			switch (tt) {
 
				case MP_RAILWAY:
 
					break;
 
				case MP_STATION:
 
					if (!HasStationRail(tile)) continue;
 
					break;
 
				case MP_ROAD:
 
					if (!IsLevelCrossing(tile)) continue;
 
					if (RailNoLevelCrossings(totype)) {
 
						error.MakeError(STR_ERROR_CROSSING_DISALLOWED);
 
						continue;
 
					}
 
					break;
 
				case MP_TUNNELBRIDGE:
 
					if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) continue;
 
					break;
 
				default: continue;
 
			}
 

	
 
			/* Original railtype we are converting from */
 
			RailType type = GetRailType(tile);
 

	
 
			/* Converting to the same type or converting 'hidden' elrail -> rail */
 
			if (type == totype || (_settings_game.vehicle.disable_elrails && totype == RAILTYPE_RAIL && type == RAILTYPE_ELECTRIC)) continue;
0 comments (0 inline, 0 general)