diff --git a/map/parsing_body.c b/map/parsing_body.c index 787ab13..c2ef3c8 100644 --- a/map/parsing_body.c +++ b/map/parsing_body.c @@ -126,6 +126,29 @@ static int map_surround(const char **body, t_map *map) return (0); } +static int body_contain_normal_char(const char **body) +{ + unsigned int y; + unsigned int x; + + y = 0; + while (body[y] != NULL) + { + x = 0; + while (body[y][x] != '\0') + { + if (!ft_is_in(" 01NEWS", body[y][x])) + { + ft_eprintf("map: %c: invalid character at rows=%u, colums=%u", body[y][x], y, x); + return (0); + } + x++; + } + y++; + } + return (1); +} + int body_is_valid(const char **body, t_map *map) { int error; @@ -155,5 +178,7 @@ int body_is_valid(const char **body, t_map *map) ft_eprintf("map: splitted"); return (0); } + if (body_contain_normal_char(body) == 0) + return (0); return (1); }