From b185cddbf01f1f6836834044ebd8476589235fef Mon Sep 17 00:00:00 2001 From: Theo Champion Date: Sat, 21 Jun 2025 00:17:09 +0200 Subject: [PATCH] almost finished norm --- src/map/map_checker.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/map/map_checker.c b/src/map/map_checker.c index f95b38f..996a21d 100644 --- a/src/map/map_checker.c +++ b/src/map/map_checker.c @@ -6,7 +6,7 @@ /* By: tchampio 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); @@ -252,7 +252,7 @@ bool check_walls(t_mapdata *map) return (true); } -void print_map(char **map) +void print_map(char **map) { int i; @@ -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);