Changeset - r19497:7f32e6905988
[Not reviewed]
master
0 1 0
frosch - 12 years ago 2012-07-18 19:25:00
frosch@openttd.org
(svn r24414) -Fix [FS#5221]: Disallow removing roadtypes from bridges when not dragging in bridge direction.
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/road_cmd.cpp
Show inline comments
 
@@ -216,6 +216,9 @@ static CommandCost RemoveRoad(TileIndex 
 

	
 
		CommandCost cost(EXPENSES_CONSTRUCTION);
 
		if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 
			/* Removing any roadbit in the bridge axis removes the roadtype (that's the behaviour remove-long-roads needs) */
 
			if ((AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) & pieces) == ROAD_NONE) return_cmd_error(rt == ROADTYPE_TRAM ? STR_ERROR_THERE_IS_NO_TRAMWAY : STR_ERROR_THERE_IS_NO_ROAD);
 

	
 
			TileIndex other_end = GetOtherTunnelBridgeEnd(tile);
 
			/* Pay for *every* tile of the bridge or tunnel */
 
			uint len = GetTunnelBridgeLength(other_end, tile) + 2;
 
@@ -651,6 +654,7 @@ CommandCost CmdBuildRoad(TileIndex tile,
 

	
 
		case MP_TUNNELBRIDGE: {
 
			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) goto do_clear;
 
			/* Only allow building the outern roadbit, so building long roads stops at existing bridges */
 
			if (MirrorRoadBits(DiagDirToRoadBits(GetTunnelBridgeDirection(tile))) != pieces) goto do_clear;
 
			if (HasTileRoadType(tile, rt)) return_cmd_error(STR_ERROR_ALREADY_BUILT);
 
			/* Don't allow adding roadtype to the bridge/tunnel when vehicles are already driving on it */
0 comments (0 inline, 0 general)