diff options
Diffstat (limited to 'src/ft_parse_map.c')
-rw-r--r-- | src/ft_parse_map.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index f51d531..77f3f47 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -30,23 +30,23 @@ ft_check_cub(const char *map_path, t_cub *clist) 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(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 int8_t ft_parse_it(int fd, t_cub *clist) @@ -105,17 +105,8 @@ ft_parse_map(const char *map_path, t_cub *clist) clist->nsew = 0; if (ft_get_map_core(fd, clist) < 0) ft_map_error(clist); + ft_check_map_last_line(clist); ft_check_missing(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); } |