diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-01-28 16:06:16 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-01-28 16:06:16 +0100 |
commit | 8703a09737e242700a918d261269ac5a650d3202 (patch) | |
tree | bca1f976e858a2e302ddcf7dd3bdf8327213efd2 | |
parent | I understood (diff) | |
download | 42-cub3d-8703a09737e242700a918d261269ac5a650d3202.tar.gz 42-cub3d-8703a09737e242700a918d261269ac5a650d3202.tar.bz2 42-cub3d-8703a09737e242700a918d261269ac5a650d3202.tar.xz 42-cub3d-8703a09737e242700a918d261269ac5a650d3202.tar.zst 42-cub3d-8703a09737e242700a918d261269ac5a650d3202.zip |
We can make it
-rw-r--r-- | src/ft_parse_map.c | 6 | ||||
-rw-r--r-- | src/ft_select_get.c | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index 49d41ba..dfa1ba6 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -78,6 +78,7 @@ void ft_parse_map(const char *map_path, t_cub *clist) { int fd; + uint8_t ret; ft_check_cub(map_path, clist); fd = open(map_path, O_RDONLY); @@ -87,7 +88,10 @@ 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_parse_it(fd, clist); + ret = 1; + while (ret != 12) + ret = ft_parse_it(fd, clist); + ft_get_map(void); /* if (ft_get_tex(fd, clist) < 0) */ /* return ; */ /* ft_check_empty_line(fd, 6, clist); */ diff --git a/src/ft_select_get.c b/src/ft_select_get.c index e6cdfd8..8e661cb 100644 --- a/src/ft_select_get.c +++ b/src/ft_select_get.c @@ -12,18 +12,20 @@ ft_get_id(char **words) return (12); } -int +uint8_t ft_select_get(char **words, t_cub *clist) { int (*fun_ptr[4])(char**, t_cub*); uint8_t id; fun_ptr[0] = ft_get_res; - fun_ptr[1] = - if ((*fun_ptr[ft_get_id(words)])(words, clist) < 0) + fun_ptr[1] = ft_get_tex; + if ((id = ft_get_id(words)) == 12) + return (12); + if (|| (*fun_ptr[id])(words, clist) < 0) { ft_free_words(words); return (ft_map_error(clist)); } - return (0); + return (id); } |