fix: Fixed map initialization

This commit is contained in:
Theo Champion 2025-10-03 23:25:50 +02:00
parent 86e16c46e4
commit 0c04f696b4

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:15:26 by kcolin #+# #+# */
/* Updated: 2025/10/03 21:06:20 by tchampio ### ########.fr */
/* Updated: 2025/10/03 23:25:16 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -48,20 +48,17 @@ bool check_walls(t_mapdata *map)
j = 0;
while (map->map[i][j] == ' ')
j++;
ft_printf("firstwalls\n");
if (map->map[i][j] != '1'
&& map->map[i][ft_strlen(map->map[i]) - 1] != '1')
return (false);
ft_printf("secondwalls\n");
if (i == 0 || i == map->mapheight - 1)
{
while (map->map[i][j] == '1' || map->map[i][j] == ' '
|| map->map[i][j] == '\n')
while (map->map[i][j] == '1' || map->map[i][j] == '2'
|| map->map[i][j] == ' ' || map->map[i][j] == '\n')
j++;
if (ft_strlen(map->map[i]) != (unsigned int)j)
return (false);
}
ft_printf("Forbidden\n");
if (has_forbidden_characters(map->map[i]))
return (false);
i++;