mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
Added wall check in the parser. Now doing the flood fill
This commit is contained in:
parent
9a39668872
commit
1206ef2f3d
2 changed files with 21 additions and 7 deletions
|
|
@ -6,10 +6,10 @@ EA ./path_to_the_east_texture
|
|||
F 256,100,0
|
||||
C 225,30,0
|
||||
|
||||
1111111111111111111111111
|
||||
1000000000110000000000001
|
||||
1011000001110000000000001
|
||||
1001000000000000000000001
|
||||
1111111111111111111111111
|
||||
1000000000110000000000001
|
||||
1011000001110000000000001
|
||||
1001000000000000000000001
|
||||
111111111011000001110000000000001
|
||||
100000000011000001110111111111111
|
||||
11110111111111011100000010001
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/06/06 17:54:42 by tchampio #+# #+# */
|
||||
/* Updated: 2025/06/20 12:43:33 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/06/20 15:23:32 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -209,11 +209,25 @@ void populate_maps(t_mapdata *map, int fd)
|
|||
bool check_walls(t_mapdata *map)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int line_length;
|
||||
|
||||
i = 0;
|
||||
while (i < map->mapheight)
|
||||
{
|
||||
ft_printf("line: %s", map->map[i]);
|
||||
j = 0;
|
||||
line_length = ft_strlen(map->map[i]);
|
||||
while (map->map[i][j] == ' ')
|
||||
j++;
|
||||
if (map->map[i][j] != '1' && map->map[i][line_length - 1] != '1')
|
||||
return (false);
|
||||
if (i == 0 || i == map->mapheight - 1)
|
||||
{
|
||||
while (map->map[i][j] == '1' || map->map[i][j] == ' ' || map->map[i][j] == '\n')
|
||||
j++;
|
||||
if (ft_strlen(map->map[i]) != (unsigned int)j)
|
||||
return (false);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue