int verif_spot(char *line, t_env *e, int fd, int i) { if (ft_occ_nb(line, '*') != 1 && line[0] != '*') return (0); if (ft_strstr(line, "spot")) ft_parse_spot(fd, line, e->spot, i); else return (0); return (1); }
bool env_parse_file(t_env *e, int fd) { t_obj obj; t_spot spot; t_cam cam; char *line; size_t i; i = 0; while (get_next_line(fd, &line) > 0 && ++i) { if (ft_regex("^.*<object>.*$", line) && ft_parse_object(&obj, fd, &i)) ft_handle_obj(e, &obj); if (ft_regex("^.*<spot>.*$", line) && ft_parse_spot(&spot, fd, &i)) ft_handle_spot(e, &spot); if (ft_regex("^.*<eye>.*$", line) && ft_parse_eye(&cam, fd, &i)) ft_handle_eye(e, &cam); ft_strdel(&line); } if (line != 0) ft_strdel(&line); close(fd); return (ft_set_eye(e)); }