Example #1
0
int				fillit(t_figures *lst, char **map, int max_map)
{
	int			i;
	int			j;

	i = 0;
	if (!lst)
		return (1);
	while (i < max_map)
	{
		j = 0;
		while (j < max_map)
		{
			if (check(lst, map, i, j))
			{
				if (fillit(lst->next, map, max_map))
					return (1);
				map = put_dots(lst, map, max_map);
			}
			j++;
		}
		i++;
	}
	return (0);
}
Example #2
0
t_dot	*make_tab(t_list *head)
{
	t_dot	*out;
	t_mlx	data;
	int		ct;

	ct = 0;
	if (!(out = (t_dot*)malloc(sizeof(t_dot) *
			((last_of(head)->x + 1) * (last_of(head)->y + 1) + 1))))
		return (NULL);
	data.len = last_of(head)->x + 1;
	data.line = last_of(head)->y + 1;
	while (head)
	{
		(out + ct)->x = BEG_X + LEN * head->x + CST * head->z * LEN;
		(out + ct)->y = BEG_Y + LEN * head->y + (CST / 2) * head->z * LEN;
		(out + ct)->end = 0;
		(out + ct)->color = 0;
		head = head->next;
		ct++;
	}
	(out + ct)->end = 1;
	put_dots(out, data);
	return (out);
}