File diff r8389:bd17295d1d08 → r8390:ef5ec525d36d
src/road_cmd.cpp
Show inline comments
 
@@ -129,16 +129,15 @@ CommandCost CmdRemoveRoad(TileIndex tile
 
		case MP_STATION:
 
			if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
 
			if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
 
			break;
 

	
 
		case MP_TUNNELBRIDGE:
 
			{
 
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
				if (GetVehicleTunnelBridge(tile, GetOtherTunnelBridgeEnd(tile)) != NULL) return CMD_ERROR;
 
			} break;
 
			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
			if (GetVehicleTunnelBridge(tile, GetOtherTunnelBridgeEnd(tile)) != NULL) return CMD_ERROR;
 
			break;
 

	
 
		default:
 
			return CMD_ERROR;
 
	}
 

	
 
	RoadBits pieces = Extract<RoadBits, 0>(p1);
 
@@ -495,24 +494,22 @@ CommandCost CmdBuildRoad(TileIndex tile,
 
			return CommandCost(EXPENSES_CONSTRUCTION, _price.build_road * (rt == ROADTYPE_ROAD ? 2 : 4));
 
		}
 

	
 
		case MP_STATION:
 
			if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
 
			if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 
			/* Don't allow "upgrading" the roadstop when vehicles are already driving on it */
 
			/* Don't allow adding roadtype to the roadstop when vehicles are already driving on it */
 
			if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
 
			break;
 

	
 
		case MP_TUNNELBRIDGE:
 
			{
 
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
				if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 

	
 
				/* Don't allow "upgrading" the bridge/tunnel when vehicles are already driving on it */
 
				if (GetVehicleTunnelBridge(tile, GetOtherTunnelBridgeEnd(tile)) != NULL) return CMD_ERROR;
 
			} break;
 
			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
			if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 
			/* Don't allow adding roadtype to the bridge/tunnel when vehicles are already driving on it */
 
			if (GetVehicleTunnelBridge(tile, GetOtherTunnelBridgeEnd(tile)) != NULL) return CMD_ERROR;
 
			break;
 

	
 
		default:
 
do_clear:;
 
			ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
			if (CmdFailed(ret)) return ret;
 
			cost.AddCost(ret);
 
@@ -669,13 +666,13 @@ CommandCost CmdBuildLongRoad(TileIndex e
 
			if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 
				if (IsBridge(tile)) {
 
					if ((!had_bridge || GetTunnelBridgeDirection(tile) == DIAGDIR_SE || GetTunnelBridgeDirection(tile) == DIAGDIR_SW)) {
 
						cost.AddCost(ret);
 
					}
 
					had_bridge = true;
 
				} else {
 
				} else { // IsTunnel(tile)
 
					if ((!had_tunnel || GetTunnelBridgeDirection(tile) == DIAGDIR_SE || GetTunnelBridgeDirection(tile) == DIAGDIR_SW)) {
 
						cost.AddCost(ret);
 
					}
 
					had_tunnel = true;
 
				}
 
			} else {