diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-04 00:36:59 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-04 00:36:59 +0100 |
commit | d5e6f1b3182816c5366515521413a5f837e7096d (patch) | |
tree | 05f5846a2595c720cf53e2728ecaddb52bd575d4 /src/ft_check_map_surrounds.c | |
parent | Chelou maps work, now sides check (diff) | |
download | 42-cub3d-d5e6f1b3182816c5366515521413a5f837e7096d.tar.gz 42-cub3d-d5e6f1b3182816c5366515521413a5f837e7096d.tar.bz2 42-cub3d-d5e6f1b3182816c5366515521413a5f837e7096d.tar.xz 42-cub3d-d5e6f1b3182816c5366515521413a5f837e7096d.tar.zst 42-cub3d-d5e6f1b3182816c5366515521413a5f837e7096d.zip |
The surrounds
Diffstat (limited to 'src/ft_check_map_surrounds.c')
-rw-r--r-- | src/ft_check_map_surrounds.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ft_check_map_surrounds.c b/src/ft_check_map_surrounds.c new file mode 100644 index 0000000..8c38a85 --- /dev/null +++ b/src/ft_check_map_surrounds.c @@ -0,0 +1,46 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_check_map_surrounds.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:34 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:37 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <stddef.h> +#include <stdint.h> + +void + ft_check_map_surrounds(t_map *ml, t_cub *cl) +{ + size_t y; + size_t x; + + (void)ml; + y = 0; + x = 0; + while (ml->map[y]) + { + while (ml->map[y][x]) + { + if (ft_ischarset("02NESWL", ml->map[y][x])) + { + if ( + ft_ischarset(" \0", ml->map[y + 1][x]) || + ft_ischarset(" \0", ml->map[y - 1][x]) || + ft_ischarset(" \0", ml->map[y][x + 1]) || + ft_ischarset(" \0", ml->map[y][x - 1]) + ) + ft_map_error(FT_ERR_MAP_WALLS, cl); + } + x++; + } + x = 0; + y++; + } +} |