mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
almost finished norm
This commit is contained in:
parent
977385492b
commit
b185cddbf0
1 changed files with 8 additions and 7 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/06/06 17:54:42 by tchampio #+# #+# */
|
||||
/* Updated: 2025/06/20 19:53:53 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/06/21 00:10:08 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -227,20 +227,20 @@ bool check_walls(t_mapdata *map)
|
|||
{
|
||||
int i;
|
||||
int j;
|
||||
int line_length;
|
||||
|
||||
i = 0;
|
||||
while (i < map->mapheight)
|
||||
{
|
||||
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')
|
||||
if (map->map[i][j] != '1'
|
||||
&& map->map[i][ft_strlen(map->map[i]) - 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')
|
||||
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);
|
||||
|
|
@ -311,7 +311,8 @@ bool check_cubfile(char *file, t_mapdata *map)
|
|||
populate_maps(map, fd);
|
||||
if (!check_walls(map))
|
||||
return (close(fd), ft_strlcpy(map->error,
|
||||
"Map is malformed (invalid chars or missing walls)", 51), false);
|
||||
"Map is malformed (invalid chars or missing walls)", 51),
|
||||
false);
|
||||
if (!check_bare_minimum(map))
|
||||
return (close(fd), false);
|
||||
return (true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue