void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)()) { t_list *tmp; t_list *tmp2; if (*begin_list) { ft_remove_list_begin(begin_list, data_ref, cmp); if (*begin_list) { tmp = *begin_list; tmp2 = tmp; tmp = tmp->next; while (tmp) { if (cmp(tmp->data, data_ref) == 0) ft_remove_list(&tmp, &tmp2); else { tmp2 = tmp; tmp = tmp->next; } } } } }
int ft_place_tetri(t_tetri *list, char **map, t_pos p, t_nb nb) { p.y = 0; if (((list->n) - 65) > (nb.nb_list / 2)) { if (ft_heuristic(list, map, nb.max) == 0) return (0); } while (map[p.y]) { p.x = 0; while (map[p.y][p.x]) { if (list && ft_verify_tetri(list, map, p, nb.max)) { ft_add_char(list, map, p); if (list->next == NULL) return (1); if (ft_place_tetri(list->next, map, p, nb)) return (1); ft_remove_list(list->pos, map, p); } p.x++; } p.y++; } return (0); }