Changeset - r12760:308cf6c9a8ac
[Not reviewed]
master
0 1 0
yexo - 15 years ago 2009-08-20 15:59:35
yexo@openttd.org
(svn r17239) -Change [FS#2802]: allow overbuilding the front tile of a roadstation / roaddepot with road
to be consistent with overbuilding the front tile of tunnels/bridges and also to make it easier for AIs to
connect roadstations and roaddepots to the road in front of it
1 file changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/road_cmd.cpp
Show inline comments
 
@@ -513,15 +513,17 @@ CommandCost CmdBuildRoad(TileIndex tile,
 
					if (pieces & ComplementRoadBits(other_bits)) goto do_clear;
 
					pieces = other_bits; // we need to pay for both roadbits
 

	
 
					if (HasTileRoadType(tile, rt)) return_cmd_error(STR_ERROR_ALREADY_BUILT);
 
					break;
 

	
 
				default:
 
				case ROAD_TILE_DEPOT:
 
					if ((GetAnyRoadBits(tile, rt) & pieces) == pieces) return_cmd_error(STR_ERROR_ALREADY_BUILT);
 
					goto do_clear;
 

	
 
				default: NOT_REACHED();
 
			}
 
			break;
 

	
 
		case MP_RAILWAY: {
 
			if (IsSteepSlope(tileh)) {
 
				return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 
@@ -562,24 +564,25 @@ CommandCost CmdBuildRoad(TileIndex tile,
 
				MarkTileDirtyByTile(tile);
 
			}
 
			return CommandCost(EXPENSES_CONSTRUCTION, _price.build_road * (rt == ROADTYPE_ROAD ? 2 : 4));
 
		}
 

	
 
		case MP_STATION: {
 
			if ((GetAnyRoadBits(tile, rt) & pieces) == pieces) return_cmd_error(STR_ERROR_ALREADY_BUILT);
 
			if (!IsDriveThroughStopTile(tile)) goto do_clear;
 

	
 
			RoadBits curbits = AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)));
 
			if (pieces & ~curbits) goto do_clear;
 
			pieces = curbits; // we need to pay for both roadbits
 

	
 
			if (HasTileRoadType(tile, rt)) return_cmd_error(STR_ERROR_ALREADY_BUILT);
 
		} break;
 

	
 
		case MP_TUNNELBRIDGE:
 
			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
			if (MirrorRoadBits(DiagDirToRoadBits(GetTunnelBridgeDirection(tile))) != pieces) return CMD_ERROR;
 
			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) goto do_clear;
 
			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 */
 
			if (HasVehicleOnTunnelBridge(tile, GetOtherTunnelBridgeEnd(tile))) return CMD_ERROR;
 
			break;
 

	
 
		default: {
0 comments (0 inline, 0 general)