void ft_parse_room_name(t_lem *lem, char **tab, int i) { long long x; long long y; int fail; fail = 0; if (!ft_seek_name(lem, tab[0]) || ft_nbrchr(tab[0], '-') != 0) { ft_litle_check_xy(lem, tab); if (ft_int(x = ft_latoi(tab[1]))) { if (ft_int(y = ft_latoi(tab[2])) && ft_check_xy(lem->anthill, x, y)) ft_pushback_room(lem, tab, i); else fail = 1; } else fail = 1; } else fail = 1; if (fail) { ft_free2d(tab); ft_exit_lem(lem); } }
void ft_check_room_2(t_lem *lem, char *line, int i, int q) { int nbr_scpace; nbr_scpace = ft_nbrchr(line, ' '); if (ft_isroom(line)) { ft_parse_room(lem, line, i); if (q) free(line); } else if (line[0] == '#') return ; else if (nbr_scpace > 2) { free(line); ft_exit_lem(lem); } else { SPIPE = 1; ft_start_end_check(lem); ft_check_pipe(lem, line); } }
char *ft_strdel_chr(char *str, char c) { int i; int j; char *nstr; nstr = ft_strnew(ft_strlen(str) - ft_nbrchr(str, c)); i = j = 0; while (str[i] != '\0') { if (str[i] != c) { nstr[j] = str[i]; j++; } i++; } return (nstr); }