/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* collision.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/08/06 11:25:05 by kcolin #+# #+# */ /* Updated: 2025/10/01 14:11:11 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ #include "collision.h" #include "../../libft/includes/libft.h" static bool out_of_bounds(t_mapdata *data, int x, int y) { if (x < 0 || y < 0 || y >= data->mapheight || x > (int)ft_strlen(data->map[y])) return (true); return (false); } bool blocks_movement(t_mapdata *data, int x, int y) { if (out_of_bounds(data, x, y) || ft_strchr("12345678dP", data->map[y][x])) return (true); return (false); } bool blocks_view(t_mapdata *data, int x, int y) { if (out_of_bounds(data, x, y) || ft_strchr("12345678dP", data->map[y][x])) return (true); return (false); }