diff options
author | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-01-27 19:20:28 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-01-27 19:20:28 +0100 |
commit | 0c2bb0f610c0af0680b46fc4566a207d59781e4d (patch) | |
tree | 986d6dd6a19416593c9b2c043312ffa5d4f0be73 /src/ft_parse_map.c | |
parent | in progress (diff) | |
download | 42-cub3d-0c2bb0f610c0af0680b46fc4566a207d59781e4d.tar.gz 42-cub3d-0c2bb0f610c0af0680b46fc4566a207d59781e4d.tar.bz2 42-cub3d-0c2bb0f610c0af0680b46fc4566a207d59781e4d.tar.xz 42-cub3d-0c2bb0f610c0af0680b46fc4566a207d59781e4d.tar.zst 42-cub3d-0c2bb0f610c0af0680b46fc4566a207d59781e4d.zip |
Switched lists entierly
Diffstat (limited to 'src/ft_parse_map.c')
-rw-r--r-- | src/ft_parse_map.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index 70b81d4..1f31ca1 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -5,7 +5,7 @@ #include <unistd.h> static void -ft_check_cub(const char *map_path, t_win *wlist) +ft_check_cub(const char *map_path, t_cub *clist) { char **words; size_t i; @@ -15,7 +15,7 @@ ft_check_cub(const char *map_path, t_win *wlist) 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_exit(2, wlist); + ft_exit(2, clist); } i = 0; while (words[i]) @@ -25,7 +25,7 @@ ft_check_cub(const char *map_path, t_win *wlist) 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_exit(2, wlist); + ft_exit(2, clist); } ft_free_words(words, NULL); } @@ -35,26 +35,27 @@ ft_check_cub(const char *map_path, t_win *wlist) */ void -ft_parse_map(const char *map_path, t_win *wlist) +ft_parse_map(const char *map_path, t_cub *clist) { int fd; - ft_check_cub(map_path, wlist); + ft_check_cub(map_path, clist); fd = open(map_path, O_RDONLY); if (fd < 0) { ft_dprintf(STDERR_FILENO, "Error\n"); ft_dprintf(STDERR_FILENO, "\033[31;1mNo map\033[0m\n"); - ft_exit(2, wlist); + ft_exit(2, clist); } - ft_get_res(fd, wlist); - if (ft_get_tex(fd, wlist) < 0) + ft_get_res(fd, clist); + if (ft_get_tex(fd, clist) < 0) return ; - ft_check_empty_line(fd, 6, wlist); - if (ft_get_sprite_tex(fd, wlist) < 0) + ft_check_empty_line(fd, 6, clist); + if (ft_get_sprite_tex(fd, clist) < 0) return ; - ft_get_colors(fd, wlist); - ft_print_list(wlist); - ft_check_empty_line(fd, 10, wlist); - ft_get_map(fd, wlist); + 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_print_list(clist); } |