fix: je vais me pendre

This commit is contained in:
Camille Chauvet 2023-06-16 14:49:40 +00:00
parent 6cd5b54918
commit 217a220705
2 changed files with 8 additions and 8 deletions

View File

@ -6,7 +6,7 @@
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */ /* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/16 14:51:13 by cchauvet #+# #+# */ /* Created: 2023/05/16 14:51:13 by cchauvet #+# #+# */
/* Updated: 2023/05/17 16:29:12 by cchauvet ### ########.fr */ /* Updated: 2023/06/16 14:39:18 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -73,11 +73,11 @@ int map_is_in_one_part(const char **body)
int y; int y;
y = ft_tablen((const void **) body) - 1; y = ft_tablen((const void **) body) - 1;
while (body[y][0] == '\0' || ft_contain_only(body[y], ' ')) while (body[y][0] == '\0')
y--; y--;
while (y > 0) while (y > 0)
{ {
if (body[y][0] == '\0' || ft_contain_only(body[y], ' ')) if (body[y][0] == '\0')
return (1); return (1);
y--; y--;
} }

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/16 16:30:55 by cchauvet #+# #+# */ /* Created: 2023/05/16 16:30:55 by cchauvet #+# #+# */
/* Updated: 2023/06/12 14:29:44 by cchauvet ### ########.fr */ /* Updated: 2023/06/16 14:47:22 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,8 +14,8 @@
static int map_surround(const char **body) static int map_surround(const char **body)
{ {
int y; size_t y;
int x; size_t x;
y = 0; y = 0;
while (body[y] != NULL) while (body[y] != NULL)
@ -27,8 +27,8 @@ static int map_surround(const char **body)
{ {
if (body[y + 1] == NULL || (y == 0) if (body[y + 1] == NULL || (y == 0)
|| (body[y][x + 1] == '\0') || (x == 0) || (body[y][x + 1] == '\0') || (x == 0)
|| (body[y + 1][x] == ' ' || body[y + 1][x] == '\0') || (x >= ft_strlen(body[y - 1])) || (body[y - 1][x] == ' ')
|| (body[y - 1][x] == ' ' || body[y - 1][x] == '\0') || (x >= ft_strlen(body[y + 1])) || (body[y + 1][x] == ' ')
|| (body[y][x - 1] == ' ' || body[y][x - 1] == '\0') || (body[y][x - 1] == ' ' || body[y][x - 1] == '\0')
|| (body[y][x + 1] == ' ' || body[y][x + 1] == '\0')) || (body[y][x + 1] == ' ' || body[y][x + 1] == '\0'))
return (1); return (1);