fix: Fixed inversion of x and y for blocking checks functions

This commit is contained in:
Theo Champion 2025-08-20 12:48:48 +02:00
parent b138fe8100
commit c643d9f22a
3 changed files with 31 additions and 31 deletions

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/06 11:25:05 by kcolin #+# #+# */
/* Updated: 2025/08/06 11:49:00 by kcolin ### ########.fr */
/* Updated: 2025/08/20 12:47:52 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,22 +17,22 @@ static bool out_of_bounds(t_mapdata *data, int x, int y)
{
if (x < 0
|| y < 0
|| x >= data->mapheight
|| y > (int)ft_strlen(data->map[x]))
|| 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) || data->map[x][y] == '1')
if (out_of_bounds(data, x, y) || data->map[y][x] == '1')
return (true);
return (false);
}
bool blocks_view(t_mapdata *data, int x, int y)
{
if (out_of_bounds(data, x, y) || data->map[x][y] == '1')
if (out_of_bounds(data, x, y) || data->map[y][x] == '1')
return (true);
return (false);
}