From 89b5e3aaf770cfb397639aa5c1ea25f5613b302e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl?= <35407363+EniumRaphael@users.noreply.github.com> Date: Tue, 2 Apr 2024 09:31:55 +0000 Subject: [PATCH] Add files via upload --- maps/empty.ber | 7 ++++--- sources/ft_init.c | 4 +++- sources/ft_map.c | 3 ++- sources/ft_move.c | 2 +- sources/ft_parse_map.c | 8 ++++---- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/maps/empty.ber b/maps/empty.ber index 21452db..a8a14f5 100644 --- a/maps/empty.ber +++ b/maps/empty.ber @@ -1,3 +1,4 @@ -1111111 -1CP00E1 -1111111 \ No newline at end of file +1111111111111 +1PCE1 +11111 + diff --git a/sources/ft_init.c b/sources/ft_init.c index fd54c29..901fd44 100644 --- a/sources/ft_init.c +++ b/sources/ft_init.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/19 13:25:35 by rparodi #+# #+# */ -/* Updated: 2024/03/17 00:16:49 by rparodi ### ########.fr */ +/* Updated: 2024/03/10 17:55:57 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -53,9 +53,11 @@ void display_map(t_mlx *mlx) t_image image; size_t i; size_t j; + size_t k; i = 0; j = 0; + k = 0; while (j < mlx->map_h && mlx->map[j]) { while (i + 1 < mlx->map_l && mlx->map[j][i] != '\0'\ diff --git a/sources/ft_map.c b/sources/ft_map.c index 9e736c5..5edc9eb 100644 --- a/sources/ft_map.c +++ b/sources/ft_map.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/21 22:51:53 by rparodi #+# #+# */ -/* Updated: 2024/03/10 18:24:45 by rparodi ### ########.fr */ +/* Updated: 2024/03/31 16:41:24 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,6 +39,7 @@ void map_size(t_mlx *mlx) prev_i = 0; while (mlx->map[j] != NULL) { + i = 0; while (mlx->map[j][i] != '\0' ) i++; if (mlx->map[j][i - 1] == '\n') diff --git a/sources/ft_move.c b/sources/ft_move.c index 573fe56..7c93cf3 100644 --- a/sources/ft_move.c +++ b/sources/ft_move.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/02 15:19:03 by rparodi #+# #+# */ -/* Updated: 2024/03/07 11:23:21 by rparodi ### ########.fr */ +/* Updated: 2024/03/31 16:55:24 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/sources/ft_parse_map.c b/sources/ft_parse_map.c index 89ebe89..2406305 100644 --- a/sources/ft_parse_map.c +++ b/sources/ft_parse_map.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/17 17:27:10 by rparodi #+# #+# */ -/* Updated: 2024/03/10 18:23:31 by rparodi ### ########.fr */ +/* Updated: 2024/03/31 16:56:32 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,7 @@ void flood_fill(char **map, int x, int y, const char *old_value) { if (ft_index_strchr(old_value, map[x][y]) == 0) return ; - map[x][y] = '.'; + map[x][y] -= 32; flood_fill(map, x + 1, y, old_value); flood_fill(map, x - 1, y, old_value); flood_fill(map, x, y + 1, old_value); @@ -30,14 +30,14 @@ void flood_fill(char **map, int x, int y, const char *old_value) void ft_access(char **map, t_mlx *mlx, size_t i, size_t j) { size_t k; - const char old_value[4] = {'P', 'C', 'E', '0'}; + const char old_value[4] = {'P', 'C', '0'}; k = 0; flood_fill(map, j, i, old_value); while (map[k] != NULL) { if (ft_index_strchr(map[k], 'C') != 0 || \ - ft_index_strchr(map[k], 'E') != 0) + ft_index_strchr(map[k], 'e') != 0) { ft_free_maps(map, NULL); ft_exit(mlx, NULL, 1, "The map is not finishable !");