diff options
Diffstat (limited to 'src/ft_parse_map.c')
-rw-r--r-- | src/ft_parse_map.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index c94a91b..49d41ba 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -14,7 +14,7 @@ ft_check_cub(const char *map_path, t_cub *clist) { ft_dprintf(STDERR_FILENO, "Error\n"); ft_dprintf(STDERR_FILENO, "\033[31;1mMap is not a .cub\033[0m\n"); - ft_free_words(words, NULL); + ft_free_words(words); ft_exit(2, clist); } i = 0; @@ -24,29 +24,29 @@ ft_check_cub(const char *map_path, t_cub *clist) { ft_dprintf(STDERR_FILENO, "Error\n"); ft_dprintf(STDERR_FILENO, "\033[31;1mMap is not a .cub\033[0m\n"); - ft_free_words(words, NULL); + ft_free_words(words); ft_exit(2, clist); } - ft_free_words(words, NULL); + ft_free_words(words); } -static void -ft_check_map_last_line(t_cub *clist) -{ - size_t i; - size_t j; +/* static void */ +/* ft_check_map_last_line(t_cub *clist) */ +/* { */ +/* size_t i; */ +/* size_t j; */ - i = 0; - while (clist->map[i]) - i++; - j = 0; - while (clist->map[i - 1][j]) - { - if (clist->map[i - 1][j] != '1' && clist->map[i - 1][j] != '\0') - ft_map_error(11 + i - 1, clist); - j++; - } -} +/* i = 0; */ +/* while (clist->map[i]) */ +/* i++; */ +/* j = 0; */ +/* while (clist->map[i - 1][j]) */ +/* { */ +/* if (clist->map[i - 1][j] != '1' && clist->map[i - 1][j] != '\0') */ +/* ft_map_error(clist); */ +/* j++; */ +/* } */ +/* } */ static int ft_parse_it(int fd, t_cub *clist) @@ -54,10 +54,11 @@ ft_parse_it(int fd, t_cub *clist) char *line; char **words; + clist->line_chk += 1; if (get_next_line(fd, &line) <= 0) { ft_memdel(line); - return (ft_map_error(clist->line_chk, clist)); + return (ft_map_error(clist)); } if (!line[0]) { @@ -67,7 +68,7 @@ ft_parse_it(int fd, t_cub *clist) if (!(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_map_error(clist->line_chk, clist)); + return (ft_map_error(clist)); } ft_memdel(line); return (ft_select_get(words, clist)); @@ -86,17 +87,17 @@ ft_parse_map(const char *map_path, t_cub *clist) ft_dprintf(STDERR_FILENO, "\033[31;1mNo map\033[0m\n"); ft_exit(2, clist); } - ft_get_res(fd, clist); - if (ft_get_tex(fd, clist) < 0) - return ; - ft_check_empty_line(fd, 6, clist); - if (ft_get_sprite_tex(fd, clist) < 0) - return ; - ft_get_colors(fd, clist); - ft_check_empty_line(fd, 10, clist); - if (ft_get_map(fd, clist) < 0) - ft_map_error(11, clist); - ft_check_map_last_line(clist); - ft_print_list(clist); + ft_parse_it(fd, clist); + /* if (ft_get_tex(fd, clist) < 0) */ + /* return ; */ + /* ft_check_empty_line(fd, 6, clist); */ + /* if (ft_get_sprite_tex(fd, clist) < 0) */ + /* return ; */ + /* ft_get_colors(fd, clist); */ + /* ft_check_empty_line(fd, 10, clist); */ + /* if (ft_get_map(fd, clist) < 0) */ + /* ft_map_error(11, clist); */ + /* ft_check_map_last_line(clist); */ + /* ft_print_list(clist); */ close(fd); } |