diff options
-rw-r--r-- | map/map_two.cub | 3 | ||||
-rw-r--r-- | src/ft_check_empty_line.c | 6 | ||||
-rw-r--r-- | src/ft_get_res.c | 5 | ||||
-rw-r--r-- | src/ft_get_sprite_tex.c | 5 | ||||
-rw-r--r-- | src/ft_get_tex.c | 20 |
5 files changed, 18 insertions, 21 deletions
diff --git a/map/map_two.cub b/map/map_two.cub index 2f45994..f445ac0 100644 --- a/map/map_two.cub +++ b/map/map_two.cub @@ -1,2 +1 @@ -R 800 600 -NO ./path_to_the_north_texture
\ No newline at end of file +R 123 123 diff --git a/src/ft_check_empty_line.c b/src/ft_check_empty_line.c index 7f58205..5515c90 100644 --- a/src/ft_check_empty_line.c +++ b/src/ft_check_empty_line.c @@ -6,7 +6,11 @@ ft_check_empty_line(int fd, unsigned int linum, t_win *wlist) { char *line; - get_next_line(fd, &line); + if (get_next_line(fd, &line) <= 0) + { + ft_memdel(line); + ft_map_error(linum, wlist); + } if (*line) { ft_memdel(line); diff --git a/src/ft_get_res.c b/src/ft_get_res.c index 8cf1809..337d3d7 100644 --- a/src/ft_get_res.c +++ b/src/ft_get_res.c @@ -19,11 +19,10 @@ ft_get_res(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(1, wlist)); } if (!(*words) || ft_strcmp(*words, "R") || !(*(words + 1)) || !(*(words + 2)) || (*(words + 3))) diff --git a/src/ft_get_sprite_tex.c b/src/ft_get_sprite_tex.c index b246b5e..308ff84 100644 --- a/src/ft_get_sprite_tex.c +++ b/src/ft_get_sprite_tex.c @@ -8,11 +8,10 @@ ft_get_sprite_tex(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(7, wlist)); } if (!(*words) || ft_strcmp(*words, "S") || !words[1] || words[2]) { diff --git a/src/ft_get_tex.c b/src/ft_get_tex.c index 7841e1d..4c80c89 100644 --- a/src/ft_get_tex.c +++ b/src/ft_get_tex.c @@ -8,11 +8,10 @@ ft_get_tex_no(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(2, wlist)); } if (!(*words) || ft_strcmp(*words, "NO") || !(*(words + 1)) || (*(words + 2))) @@ -36,11 +35,10 @@ ft_get_tex_so(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(3, wlist)); } if (!(*words) || ft_strcmp(*words, "SO") || !(*(words + 1)) || (*(words + 2))) @@ -64,11 +62,10 @@ ft_get_tex_we(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(4, wlist)); } if (!(*words) || ft_strcmp(*words, "WE") || !(*(words + 1)) || (*(words + 2))) @@ -92,11 +89,10 @@ ft_get_tex_ea(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(5, wlist)); } if (!(*words) || ft_strcmp(*words, "EA") || !(*(words + 1)) || (*(words + 2))) |