diff --git a/.ber b/.ber deleted file mode 100644 index e69de29..0000000 diff --git a/MacroLibX/example/42_logo.bmp b/MacroLibX/.example/42_logo.bmp similarity index 100% rename from MacroLibX/example/42_logo.bmp rename to MacroLibX/.example/42_logo.bmp diff --git a/MacroLibX/example/42_logo.jpg b/MacroLibX/.example/42_logo.jpg similarity index 100% rename from MacroLibX/example/42_logo.jpg rename to MacroLibX/.example/42_logo.jpg diff --git a/MacroLibX/example/42_logo.png b/MacroLibX/.example/42_logo.png similarity index 100% rename from MacroLibX/example/42_logo.png rename to MacroLibX/.example/42_logo.png diff --git a/MacroLibX/example/build.sh b/MacroLibX/.example/build.sh similarity index 100% rename from MacroLibX/example/build.sh rename to MacroLibX/.example/build.sh diff --git a/MacroLibX/example/font.ttf b/MacroLibX/.example/font.ttf similarity index 100% rename from MacroLibX/example/font.ttf rename to MacroLibX/.example/font.ttf diff --git a/MacroLibX/example/main.c b/MacroLibX/.example/main.c similarity index 100% rename from MacroLibX/example/main.c rename to MacroLibX/.example/main.c diff --git a/MacroLibX/example/run.sh b/MacroLibX/.example/run.sh similarity index 100% rename from MacroLibX/example/run.sh rename to MacroLibX/.example/run.sh diff --git a/Makefile b/Makefile index d7acac5..6244189 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: adjoly +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/01 11:03:22 by adjoly #+# #+# # -# Updated: 2024/01/19 13:41:58 by adjoly ### ########.fr # +# Updated: 2024/01/26 16:16:13 by adjoly ### ########.fr # # # # **************************************************************************** # @@ -16,9 +16,17 @@ CC = cc SRCS = main.c \ get_map.c \ - ft_move_character.c \ print_map.c \ - ft_check_map_error.c + map_error/ft_check_file.c \ + map_error/ft_check_map_content.c \ + map_error/ft_check_map_error.c \ + map_error/ft_check_map_state.c \ + map_error/ft_check_map_utils.c \ + move_character/ft_move_character.c \ + move_character/ft_move_down.c \ + move_character/ft_move_up.c \ + move_character/ft_move_left.c \ + move_character/ft_move_right.c OBJS = $(SRCS:.c=.o) diff --git a/ft_check_map_error.c b/ft_check_map_error.c deleted file mode 100644 index f51b7e6..0000000 --- a/ft_check_map_error.c +++ /dev/null @@ -1,280 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_check_map_error.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: adjoly +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/01/17 10:17:52 by adjoly #+# #+# */ -/* Updated: 2024/01/24 12:35:46 by adjoly ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft/libft.h" -#include "printf/ft_printf.h" -#include "so_long.h" -#include -#include -#include - -char ft_check_charset(char c, char *charset) -{ - unsigned short i; - - i = 0; - while (charset[i] && i < USHRT_MAX) - { - if (c == charset[i]) - return (0); - i++; - } - return (1); -} - -char ft_check_file(char *file_name) -{ - int fd; - - fd = open(file_name, O_RDONLY); - if (fd < 1) - { - close(fd); - return (1); - } - close(fd); - return (0); -} - -char ft_valid_char(char **map) -{ - size_t y; - size_t x; - - y = 0; - while (map[y]) - { - x = 0; - while (map[y][x]) - { - if (ft_check_charset(map[y][x], "01CEP") == 1) - return (1); - x++; - } - y++; - } - return (0); -} - -char ft_check_element(char **map, t_coords *p_coords) -{ - size_t y; - size_t x; - size_t p_count; - size_t e_count; - size_t c_count; - - y = 0; - p_count = 0; - e_count = 0; - c_count = 0; - while (map[y]) - { - x = 0; - while (map[y][x]) - { - if (map[y][x] == 'P') - { - p_count++; - p_coords->x = x; - p_coords->y = y; - } - else if (map[y][x] == 'E') - e_count++; - else if (map[y][x] == 'C') - c_count++; - x++; - } - y++; - } - if (p_count != 1) - return (1); - else if (e_count != 1) - return (2); - else if (c_count < 1) - return (3); - return (0); -} - -void ft_flood(int x, int y, char **map) -{ - if (map[y][x] != '1') - { - map[y][x] = '1'; - ft_flood(x - 1, y, map); - ft_flood(x + 1, y, map); - ft_flood(x, y - 1, map); - ft_flood(x, y + 1, map); - } -} - -char ft_floodfill(char **map, t_coords *p_coords) -{ - size_t x; - size_t y; - - ft_flood(p_coords->x, p_coords->y, map); - y = 0; - while (map[y]) - { - x = 0; - while (map[y][x]) - { - if (map[y][x] == 'C' || map[y][x] == 'E') - return (1); - x++; - } - y++; - } - return (0); -} - -char ft_checkline(char *map_line, char c) -{ - unsigned short i; - - i = 0; - while (*map_line && i < USHRT_MAX) - { - if (*map_line != c) - return (1); - map_line++; - i++; - } - return (0); -} - -char ft_checkcol(char **map, char c, unsigned short col) -{ - unsigned short i; - - i = 0; - while (map[i] && i < USHRT_MAX) - { - if (map[i][col] != c) - return (1); - i++; - } - return (0); -} - -char ft_is_closed(char **map) -{ - unsigned short size_map; - unsigned short size_line; - unsigned short i; - unsigned short res; - - i = 0; - size_map = ft_mapsize(map); - size_line = ft_strlen(map[0]); - res = ft_checkcol(map, '1', 0); - res += ft_checkcol(map, '1', size_line - 1); - res += ft_checkline(map[0], '1'); - res += ft_checkline(map[size_map - 1], '1'); - if (res > 0) - return (1); - return (0); -} - -char ft_is_empty(char **map) -{ - if (map[0][0] == '\0') - return (1); - return (0); -} - -char ft_is_rectangular(char **map) -{ - size_t len_map; - - len_map = ft_strlen(*map); - while (*map) - { - if (ft_strlen(*map) != len_map) - return (1); - map++; - } - return (0); -} - -char ft_valid_file_ext(char *file_name) -{ - unsigned short file_len; - - file_len = ft_strlen(file_name) - 1; - if (file_len <= 3) - return (1); - else if (file_name[file_len] == 'r' && file_name[file_len - 1] == 'e' \ - && file_name[file_len - 2] == 'b' && file_name[file_len - 3] == '.') - return (0); - return (1); -} - -void ft_send_error(char *msg, char **map) -{ - ft_putstr_fd("Error\n", 1); - ft_putstr_fd(msg, 1); - if (map) - ft_freemap(map); - exit(EXIT_SUCCESS); -} - -void ft_check_map_error(char **map) -{ - char check_result; - t_coords *p_coords; - - p_coords = malloc(sizeof(t_coords)); - if (ft_is_empty(map) == 1) - { - free(p_coords); - ft_send_error("Map is empty", map); - } - if (ft_valid_char(map) == 1) - { - free(p_coords); - ft_send_error("Invalid character in map\n", map); - } - if (ft_is_rectangular(map) == 1) - { - free(p_coords); - ft_send_error("Map is not rectengular\n", map); - } - check_result = ft_check_element(map, p_coords); - if (check_result == 1) - { - free(p_coords); - ft_send_error("Invalid number of player\n", map); - } - if (check_result == 2) - { - free(p_coords); - ft_send_error("Invalid number of exit\n", map); - } - if (check_result == 3) - { - free(p_coords); - ft_send_error("Invalid number of collectible\n", map); - } - if (ft_is_closed(map) == 1) - { - free(p_coords); - ft_send_error("Map is not closed\n", map); - } - if (ft_floodfill(map, p_coords) == 1) - { - free(p_coords); - ft_send_error("Map is cannot be finished\n", map); - } - free(p_coords); -} diff --git a/ft_move_character.c b/ft_move_character.c deleted file mode 100644 index a9b8327..0000000 --- a/ft_move_character.c +++ /dev/null @@ -1,171 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_move_character.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: adjoly +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/01/07 19:13:01 by adjoly #+# #+# */ -/* Updated: 2024/01/24 12:16:14 by adjoly ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "so_long.h" - -void ft_move_up(t_window *win) -{ - if (win->map[win->p_coords->y - 1][win->p_coords->x] == 'C') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); - win->map[win->p_coords->y - 1][win->p_coords->x] = '0'; - ft_putimg(win->p_coords->x, win->p_coords->y - 1, win, 'P'); - win->c_count--; - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } - else if (win->p_coords->y == win->e_coords->y - && win->e_coords->x == win->p_coords->x - && win->map[win->p_coords->y - 1][win->p_coords->x] != '1') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, 'E'); - ft_putimg(win->p_coords->x, win->p_coords->y - 1, win, 'P'); - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } - else if (win->map[win->p_coords->y - 1][win->p_coords->x] == 'E' - && win->c_count == 0) - { - ft_printf("Mouvement : %d\n", win->mov_count + 1); - ft_exit(win); - } - else if (win->map[win->p_coords->y - 1][win->p_coords->x] != '1') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); - ft_putimg(win->p_coords->x, win->p_coords->y - 1, win, 'P'); - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } -} - -void ft_move_down(t_window *win) -{ - if (win->map[win->p_coords->y + 1][win->p_coords->x] == 'C') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); - win->map[win->p_coords->y + 1][win->p_coords->x] = '0'; - ft_putimg(win->p_coords->x, win->p_coords->y + 1, win, 'P'); - win->c_count--; - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } - else if (win->p_coords->y == win->e_coords->y - && win->e_coords->x == win->p_coords->x - && win->map[win->p_coords->y + 1][win->p_coords->x] != '1') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, 'E'); - ft_putimg(win->p_coords->x, win->p_coords->y + 1, win, 'P'); - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } - else if (win->map[win->p_coords->y + 1][win->p_coords->x] == 'E' - && win->c_count == 0) - { - ft_printf("Mouvement : %d\n", win->mov_count + 1); - ft_exit(win); - } - else if (win->map[win->p_coords->y + 1][win->p_coords->x] != '1') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); - ft_putimg(win->p_coords->x, win->p_coords->y + 1, win, 'P'); - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } -} - -void ft_move_left(t_window *win) -{ - if (win->map[win->p_coords->y][win->p_coords->x - 1] == 'C') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); - win->map[win->p_coords->y][win->p_coords->x - 1] = '0'; - ft_putimg(win->p_coords->x - 1, win->p_coords->y, win, 'P'); - win->c_count--; - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } - else if (win->p_coords->y == win->e_coords->y - && win->e_coords->x == win->p_coords->x - && win->map[win->p_coords->y][win->p_coords->x - 1] != '1') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, 'E'); - ft_putimg(win->p_coords->x - 1, win->p_coords->y, win, 'P'); - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } - else if (win->map[win->p_coords->y][win->p_coords->x - 1] == 'E' - && win->c_count == 0) - { - ft_printf("Mouvement : %d\n", win->mov_count + 1); - ft_exit(win); - } - else if (win->map[win->p_coords->y][win->p_coords->x - 1] != '1') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); - ft_putimg(win->p_coords->x - 1, win->p_coords->y, win, 'P'); - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } -} - -void ft_move_right(t_window *win) -{ - if (win->map[win->p_coords->y][win->p_coords->x + 1] == 'C') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); - win->map[win->p_coords->y][win->p_coords->x + 1] = '0'; - ft_putimg(win->p_coords->x + 1, win->p_coords->y, win, 'P'); - win->c_count--; - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } - else if (win->p_coords->y == win->e_coords->y - && win->e_coords->x == win->p_coords->x - && win->map[win->p_coords->y][win->p_coords->x + 1] != '1') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, 'E'); - ft_putimg(win->p_coords->x + 1, win->p_coords->y, win, 'P'); - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } - else if (win->map[win->p_coords->y][win->p_coords->x + 1] == 'E' - && win->c_count == 0) - { - ft_printf("Mouvement : %d\n", win->mov_count + 1); - ft_exit(win); - } - else if (win->map[win->p_coords->y][win->p_coords->x + 1] != '1') - { - ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); - ft_putimg(win->p_coords->x + 1, win->p_coords->y, win, 'P'); - win->mov_count++; - ft_printf("Mouvement : %d\n", win->mov_count); - } -} - -int ft_key_event(int key, void *param) -{ - t_window *win; - - win = (t_window *)param; - if (key == 41) - ft_exit(win); - if (key == 26 || key == 82) - ft_move_up(win); - else if (key == 22 || key == 81) - ft_move_down(win); - else if (key == 4 || key == 80) - ft_move_left(win); - else if (key == 7 || key == 79) - ft_move_right(win); - return (0); -} diff --git a/get_map.o b/get_map.o new file mode 100644 index 0000000..06726f9 Binary files /dev/null and b/get_map.o differ diff --git a/get_next_line/get_next_line.a b/get_next_line/get_next_line.a new file mode 100644 index 0000000..2ad8e08 Binary files /dev/null and b/get_next_line/get_next_line.a differ diff --git a/get_next_line/get_next_line.o b/get_next_line/get_next_line.o new file mode 100644 index 0000000..b0bbd67 Binary files /dev/null and b/get_next_line/get_next_line.o differ diff --git a/get_next_line/get_next_line_utils.o b/get_next_line/get_next_line_utils.o new file mode 100644 index 0000000..c8c7179 Binary files /dev/null and b/get_next_line/get_next_line_utils.o differ diff --git a/libft/ft_atoi.o b/libft/ft_atoi.o new file mode 100644 index 0000000..afb0010 Binary files /dev/null and b/libft/ft_atoi.o differ diff --git a/libft/ft_bzero.o b/libft/ft_bzero.o new file mode 100644 index 0000000..62d7f17 Binary files /dev/null and b/libft/ft_bzero.o differ diff --git a/libft/ft_calloc.o b/libft/ft_calloc.o new file mode 100644 index 0000000..6fada56 Binary files /dev/null and b/libft/ft_calloc.o differ diff --git a/libft/ft_isalnum.o b/libft/ft_isalnum.o new file mode 100644 index 0000000..aecf709 Binary files /dev/null and b/libft/ft_isalnum.o differ diff --git a/libft/ft_isalpha.o b/libft/ft_isalpha.o new file mode 100644 index 0000000..0bd62e8 Binary files /dev/null and b/libft/ft_isalpha.o differ diff --git a/libft/ft_isascii.o b/libft/ft_isascii.o new file mode 100644 index 0000000..11cdcbf Binary files /dev/null and b/libft/ft_isascii.o differ diff --git a/libft/ft_isdigit.o b/libft/ft_isdigit.o new file mode 100644 index 0000000..9473b5f Binary files /dev/null and b/libft/ft_isdigit.o differ diff --git a/libft/ft_isprint.o b/libft/ft_isprint.o new file mode 100644 index 0000000..fa1d564 Binary files /dev/null and b/libft/ft_isprint.o differ diff --git a/libft/ft_itoa.o b/libft/ft_itoa.o new file mode 100644 index 0000000..9d54483 Binary files /dev/null and b/libft/ft_itoa.o differ diff --git a/libft/ft_lstadd_back.o b/libft/ft_lstadd_back.o new file mode 100644 index 0000000..83158d2 Binary files /dev/null and b/libft/ft_lstadd_back.o differ diff --git a/libft/ft_lstadd_front.o b/libft/ft_lstadd_front.o new file mode 100644 index 0000000..c480e34 Binary files /dev/null and b/libft/ft_lstadd_front.o differ diff --git a/libft/ft_lstclear.o b/libft/ft_lstclear.o new file mode 100644 index 0000000..3b791fb Binary files /dev/null and b/libft/ft_lstclear.o differ diff --git a/libft/ft_lstdelone.o b/libft/ft_lstdelone.o new file mode 100644 index 0000000..b0055fa Binary files /dev/null and b/libft/ft_lstdelone.o differ diff --git a/libft/ft_lstiter.o b/libft/ft_lstiter.o new file mode 100644 index 0000000..4fc4d3a Binary files /dev/null and b/libft/ft_lstiter.o differ diff --git a/libft/ft_lstlast.o b/libft/ft_lstlast.o new file mode 100644 index 0000000..af009cf Binary files /dev/null and b/libft/ft_lstlast.o differ diff --git a/libft/ft_lstmap.o b/libft/ft_lstmap.o new file mode 100644 index 0000000..f038204 Binary files /dev/null and b/libft/ft_lstmap.o differ diff --git a/libft/ft_lstnew.o b/libft/ft_lstnew.o new file mode 100644 index 0000000..e258459 Binary files /dev/null and b/libft/ft_lstnew.o differ diff --git a/libft/ft_lstsize.o b/libft/ft_lstsize.o new file mode 100644 index 0000000..d476de5 Binary files /dev/null and b/libft/ft_lstsize.o differ diff --git a/libft/ft_memchr.o b/libft/ft_memchr.o new file mode 100644 index 0000000..be0211d Binary files /dev/null and b/libft/ft_memchr.o differ diff --git a/libft/ft_memcmp.o b/libft/ft_memcmp.o new file mode 100644 index 0000000..f6e2703 Binary files /dev/null and b/libft/ft_memcmp.o differ diff --git a/libft/ft_memcpy.o b/libft/ft_memcpy.o new file mode 100644 index 0000000..6fec394 Binary files /dev/null and b/libft/ft_memcpy.o differ diff --git a/libft/ft_memmove.o b/libft/ft_memmove.o new file mode 100644 index 0000000..02381d8 Binary files /dev/null and b/libft/ft_memmove.o differ diff --git a/libft/ft_memset.o b/libft/ft_memset.o new file mode 100644 index 0000000..936618d Binary files /dev/null and b/libft/ft_memset.o differ diff --git a/libft/ft_putchar_fd.o b/libft/ft_putchar_fd.o new file mode 100644 index 0000000..786101f Binary files /dev/null and b/libft/ft_putchar_fd.o differ diff --git a/libft/ft_putendl_fd.o b/libft/ft_putendl_fd.o new file mode 100644 index 0000000..fedf787 Binary files /dev/null and b/libft/ft_putendl_fd.o differ diff --git a/libft/ft_putnbr_fd.o b/libft/ft_putnbr_fd.o new file mode 100644 index 0000000..82110de Binary files /dev/null and b/libft/ft_putnbr_fd.o differ diff --git a/libft/ft_putstr_fd.o b/libft/ft_putstr_fd.o new file mode 100644 index 0000000..b731fc0 Binary files /dev/null and b/libft/ft_putstr_fd.o differ diff --git a/libft/ft_split.o b/libft/ft_split.o new file mode 100644 index 0000000..31a281e Binary files /dev/null and b/libft/ft_split.o differ diff --git a/libft/ft_strchr.o b/libft/ft_strchr.o new file mode 100644 index 0000000..c5583ff Binary files /dev/null and b/libft/ft_strchr.o differ diff --git a/libft/ft_strdup.o b/libft/ft_strdup.o new file mode 100644 index 0000000..5c511ad Binary files /dev/null and b/libft/ft_strdup.o differ diff --git a/libft/ft_striteri.o b/libft/ft_striteri.o new file mode 100644 index 0000000..791eac5 Binary files /dev/null and b/libft/ft_striteri.o differ diff --git a/libft/ft_strjoin.o b/libft/ft_strjoin.o new file mode 100644 index 0000000..868baa1 Binary files /dev/null and b/libft/ft_strjoin.o differ diff --git a/libft/ft_strlcat.o b/libft/ft_strlcat.o new file mode 100644 index 0000000..fffbf92 Binary files /dev/null and b/libft/ft_strlcat.o differ diff --git a/libft/ft_strlcpy.o b/libft/ft_strlcpy.o new file mode 100644 index 0000000..e25b437 Binary files /dev/null and b/libft/ft_strlcpy.o differ diff --git a/libft/ft_strlen.o b/libft/ft_strlen.o new file mode 100644 index 0000000..fec4953 Binary files /dev/null and b/libft/ft_strlen.o differ diff --git a/libft/ft_strmapi.o b/libft/ft_strmapi.o new file mode 100644 index 0000000..81a145a Binary files /dev/null and b/libft/ft_strmapi.o differ diff --git a/libft/ft_strncmp.o b/libft/ft_strncmp.o new file mode 100644 index 0000000..1f797d9 Binary files /dev/null and b/libft/ft_strncmp.o differ diff --git a/libft/ft_strnstr.o b/libft/ft_strnstr.o new file mode 100644 index 0000000..bfbe0b7 Binary files /dev/null and b/libft/ft_strnstr.o differ diff --git a/libft/ft_strrchr.o b/libft/ft_strrchr.o new file mode 100644 index 0000000..aa9ce75 Binary files /dev/null and b/libft/ft_strrchr.o differ diff --git a/libft/ft_strtrim.o b/libft/ft_strtrim.o new file mode 100644 index 0000000..d2ff71e Binary files /dev/null and b/libft/ft_strtrim.o differ diff --git a/libft/ft_substr.o b/libft/ft_substr.o new file mode 100644 index 0000000..d811f99 Binary files /dev/null and b/libft/ft_substr.o differ diff --git a/libft/ft_tolower.o b/libft/ft_tolower.o new file mode 100644 index 0000000..9fde8fe Binary files /dev/null and b/libft/ft_tolower.o differ diff --git a/libft/ft_toupper.o b/libft/ft_toupper.o new file mode 100644 index 0000000..374dad9 Binary files /dev/null and b/libft/ft_toupper.o differ diff --git a/libft/libft.a b/libft/libft.a new file mode 100644 index 0000000..bdc9914 Binary files /dev/null and b/libft/libft.a differ diff --git a/main.o b/main.o new file mode 100644 index 0000000..6f8b0bf Binary files /dev/null and b/main.o differ diff --git a/map.ber b/map.ber index 63f1a56..e278b22 100644 --- a/map.ber +++ b/map.ber @@ -1,5 +1,14 @@ 1111111111111 -100100000C1E1 -100P010011101 -10C0110000001 +1CC1CCCCCC1C1 +1CCPC1CC111C1 +1CCC11CCCCCC1 +1CC1CCCCCC1E1 +1CCCC1CC111C1 +1CC1CCCCCC1C1 +1CCCC1CC111C1 +1CCC11CCCCCC1 +1CCC11CCCCCC1 +1CC1CCCCCC111 +1CCCC1CC111C1 +1CCC11CCCCCC1 1111111111111 \ No newline at end of file diff --git a/map.txt.ber b/map.txt.ber index 63f1a56..ce20e32 100644 --- a/map.txt.ber +++ b/map.txt.ber @@ -2,4 +2,7 @@ 100100000C1E1 100P010011101 10C0110000001 +100100000C1E1 +100P010011101 +10C0110000001 1111111111111 \ No newline at end of file diff --git a/map_error/ft_check_file.c b/map_error/ft_check_file.c new file mode 100644 index 0000000..369832d --- /dev/null +++ b/map_error/ft_check_file.c @@ -0,0 +1,47 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_check_file.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/26 14:29:02 by adjoly #+# #+# */ +/* Updated: 2024/01/26 16:10:23 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +char ft_check_file(char *file_name) +{ + int fd; + + fd = open(file_name, O_RDONLY); + if (fd < 1) + { + close(fd); + return (1); + } + close(fd); + return (0); +} + +char ft_valid_file_ext(char *file_name) +{ + unsigned short file_len; + + file_len = ft_strlen(file_name) - 1; + if (file_len <= 3) + return (1); + else if (file_name[file_len] == 'r' && file_name[file_len - 1] == 'e' \ + && file_name[file_len - 2] == 'b' && file_name[file_len - 3] == '.') + return (0); + return (1); +} + +char ft_is_empty(char **map) +{ + if (map[0][0] == '\0') + return (1); + return (0); +} diff --git a/map_error/ft_check_file.o b/map_error/ft_check_file.o new file mode 100644 index 0000000..f4dea71 Binary files /dev/null and b/map_error/ft_check_file.o differ diff --git a/map_error/ft_check_map_content.c b/map_error/ft_check_map_content.c new file mode 100644 index 0000000..61374e9 --- /dev/null +++ b/map_error/ft_check_map_content.c @@ -0,0 +1,80 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_check_map_content.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/26 01:31:27 by adjoly #+# #+# */ +/* Updated: 2024/01/26 16:10:32 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +char ft_check_reselement(t_elemcount *count) +{ + if (count->p_count != 1) + return (1); + else if (count->e_count != 1) + return (2); + else if (count->c_count < 1) + return (3); + return (0); +} + +char ft_check_element(char **map, t_coords *p_coords, t_elemcount *count) +{ + int y; + int x; + + y = -1; + count->c_count = 0; + count->e_count = 0; + count->p_count = 0; + while (map[++y]) + { + x = -1; + while (map[y][++x]) + { + if (map[y][x] == 'P') + { + count->p_count++; + p_coords->x = x; + p_coords->y = y; + } + else if (map[y][x] == 'E') + count->e_count++; + else if (map[y][x] == 'C') + count->c_count++; + } + } + return (ft_check_reselement(count)); +} + +void ft_check_map_content(char **map, t_coords *p_coords) +{ + char check_result; + t_elemcount *count; + + count = malloc(sizeof(t_elemcount *)); + check_result = ft_check_element(map, p_coords, count); + if (check_result == 1) + { + free(count); + free(p_coords); + ft_send_error("Invalid number of player\n", map); + } + if (check_result == 2) + { + free(count); + free(p_coords); + ft_send_error("Invalid number of exit\n", map); + } + if (check_result == 3) + { + free(count); + free(p_coords); + ft_send_error("Invalid number of collectible\n", map); + } +} diff --git a/map_error/ft_check_map_content.o b/map_error/ft_check_map_content.o new file mode 100644 index 0000000..7679310 Binary files /dev/null and b/map_error/ft_check_map_content.o differ diff --git a/map_error/ft_check_map_error.c b/map_error/ft_check_map_error.c new file mode 100644 index 0000000..83dac94 --- /dev/null +++ b/map_error/ft_check_map_error.c @@ -0,0 +1,103 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_check_map_error.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/17 10:17:52 by adjoly #+# #+# */ +/* Updated: 2024/01/26 16:10:46 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +char ft_checkcol(char **map, char c, unsigned short col) +{ + unsigned short i; + + i = 0; + while (map[i] && i < USHRT_MAX) + { + if (map[i][col] != c) + return (1); + i++; + } + return (0); +} + +char ft_is_rectangular(char **map) +{ + size_t len_map; + + len_map = ft_strlen(*map); + while (*map) + { + if (ft_strlen(*map) != len_map) + return (1); + map++; + } + return (0); +} + +char ft_valid_char(char **map) +{ + size_t y; + size_t x; + + y = 0; + while (map[y]) + { + x = 0; + while (map[y][x]) + { + if (ft_check_charset(map[y][x], "01CEP") == 1) + return (1); + x++; + } + y++; + } + return (0); +} + +char ft_checkline(char *map_line, char c) +{ + unsigned short i; + + i = 0; + while (*map_line && i < USHRT_MAX) + { + if (*map_line != c) + return (1); + map_line++; + i++; + } + return (0); +} + +void ft_check_map_error(char **map) +{ + t_coords *p_coords; + + p_coords = malloc(sizeof(t_coords)); + if (!p_coords) + ft_send_error("Memory allocation failed\n", map); + if (ft_is_empty(map) == 1) + { + free(p_coords); + ft_send_error("Map is empty", map); + } + if (ft_valid_char(map) == 1) + { + free(p_coords); + ft_send_error("Invalid character in map\n", map); + } + if (ft_is_rectangular(map) == 1) + { + free(p_coords); + ft_send_error("Map is not rectengular\n", map); + } + ft_check_map_content(map, p_coords); + ft_check_map_state(map, p_coords); + free(p_coords); +} diff --git a/map_error/ft_check_map_error.o b/map_error/ft_check_map_error.o new file mode 100644 index 0000000..050ae89 Binary files /dev/null and b/map_error/ft_check_map_error.o differ diff --git a/map_error/ft_check_map_state.c b/map_error/ft_check_map_state.c new file mode 100644 index 0000000..6d26195 --- /dev/null +++ b/map_error/ft_check_map_state.c @@ -0,0 +1,79 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_check_map_state.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/26 14:36:23 by adjoly #+# #+# */ +/* Updated: 2024/01/26 16:10:55 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +void ft_flood(int x, int y, char **map) +{ + if (map[y][x] != '1') + { + map[y][x] = '1'; + ft_flood(x - 1, y, map); + ft_flood(x + 1, y, map); + ft_flood(x, y - 1, map); + ft_flood(x, y + 1, map); + } +} + +char ft_floodfill(char **map, t_coords *p_coords) +{ + size_t x; + size_t y; + + ft_flood(p_coords->x, p_coords->y, map); + y = 0; + while (map[y]) + { + x = 0; + while (map[y][x]) + { + if (map[y][x] == 'C' || map[y][x] == 'E') + return (1); + x++; + } + y++; + } + return (0); +} + +char ft_is_closed(char **map) +{ + unsigned short size_map; + unsigned short size_line; + unsigned short i; + unsigned short res; + + i = 0; + size_map = ft_mapsize(map); + size_line = ft_strlen(map[0]); + res = ft_checkcol(map, '1', 0); + res += ft_checkcol(map, '1', size_line - 1); + res += ft_checkline(map[0], '1'); + res += ft_checkline(map[size_map - 1], '1'); + if (res > 0) + return (1); + return (0); +} + +void ft_check_map_state(char **map, t_coords *p_coords) +{ + if (ft_is_closed(map) == 1) + { + free(p_coords); + ft_send_error("Map is not closed\n", map); + } + if (ft_floodfill(map, p_coords) == 1) + { + free(p_coords); + ft_send_error("Map is cannot be finished\n", map); + } +} diff --git a/map_error/ft_check_map_state.o b/map_error/ft_check_map_state.o new file mode 100644 index 0000000..7933c99 Binary files /dev/null and b/map_error/ft_check_map_state.o differ diff --git a/map_error/ft_check_map_utils.c b/map_error/ft_check_map_utils.c new file mode 100644 index 0000000..4dcbf43 --- /dev/null +++ b/map_error/ft_check_map_utils.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_check_map_utils.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/26 15:28:38 by adjoly #+# #+# */ +/* Updated: 2024/01/26 16:12:43 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +void ft_send_error(char *msg, char **map) +{ + ft_putstr_fd("Error\n", 1); + ft_putstr_fd(msg, 1); + if (map) + ft_freemap(map); + exit(EXIT_SUCCESS); +} + +char ft_check_charset(char c, char *charset) +{ + unsigned short i; + + i = 0; + while (charset[i] && i < USHRT_MAX) + { + if (c == charset[i]) + return (0); + i++; + } + return (1); +} diff --git a/map_error/ft_check_map_utils.o b/map_error/ft_check_map_utils.o new file mode 100644 index 0000000..9659ddd Binary files /dev/null and b/map_error/ft_check_map_utils.o differ diff --git a/move_character/ft_move_character.c b/move_character/ft_move_character.c new file mode 100644 index 0000000..b2822e3 --- /dev/null +++ b/move_character/ft_move_character.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_move_character.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/07 19:13:01 by adjoly #+# #+# */ +/* Updated: 2024/01/26 16:10:05 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +void ft_printmov(t_window *win) +{ + win->mov_count++; + ft_printf("Mouvement : %d\n", win->mov_count); +} + +int ft_key_event(int key, void *param) +{ + t_window *win; + + win = (t_window *)param; + if (key == 41) + ft_exit(win); + if (key == 26 || key == 82) + ft_move_up(win); + else if (key == 22 || key == 81) + ft_move_down(win); + else if (key == 4 || key == 80) + ft_move_left(win); + else if (key == 7 || key == 79) + ft_move_right(win); + return (0); +} diff --git a/move_character/ft_move_character.o b/move_character/ft_move_character.o new file mode 100644 index 0000000..5042ad8 Binary files /dev/null and b/move_character/ft_move_character.o differ diff --git a/move_character/ft_move_down.c b/move_character/ft_move_down.c new file mode 100644 index 0000000..f5a4920 --- /dev/null +++ b/move_character/ft_move_down.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_move_down.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/26 15:50:27 by adjoly #+# #+# */ +/* Updated: 2024/01/26 17:45:28 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +void ft_move_down(t_window *win) +{ + if (win->p_coords->y == win->e_coords->y + && win->e_coords->x == win->p_coords->x + && win->map[win->p_coords->y + 1][win->p_coords->x] != '1') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, 'E'); + ft_putimg(win->p_coords->x, win->p_coords->y + 1, win, 'P'); + ft_printmov(win); + } + else if (win->map[win->p_coords->y + 1][win->p_coords->x] == 'C') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + win->map[win->p_coords->y + 1][win->p_coords->x] = '0'; + ft_putimg(win->p_coords->x, win->p_coords->y + 1, win, 'P'); + win->c_count--; + ft_printmov(win); + } + else if (win->map[win->p_coords->y + 1][win->p_coords->x] == 'E' + && win->c_count == 0) + { + ft_printmov(win); + ft_exit(win); + } + else if (win->map[win->p_coords->y + 1][win->p_coords->x] != '1') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + ft_putimg(win->p_coords->x, win->p_coords->y + 1, win, 'P'); + ft_printmov(win); + } +} diff --git a/move_character/ft_move_down.o b/move_character/ft_move_down.o new file mode 100644 index 0000000..9becc33 Binary files /dev/null and b/move_character/ft_move_down.o differ diff --git a/move_character/ft_move_left.c b/move_character/ft_move_left.c new file mode 100644 index 0000000..0e1267f --- /dev/null +++ b/move_character/ft_move_left.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_move_left.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/26 15:50:22 by adjoly #+# #+# */ +/* Updated: 2024/01/26 17:45:10 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +void ft_move_left(t_window *win) +{ + if (win->p_coords->y == win->e_coords->y + && win->e_coords->x == win->p_coords->x + && win->map[win->p_coords->y][win->p_coords->x - 1] != '1') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, 'E'); + ft_putimg(win->p_coords->x - 1, win->p_coords->y, win, 'P'); + ft_printmov(win); + } + else if (win->map[win->p_coords->y][win->p_coords->x - 1] == 'C') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + win->map[win->p_coords->y][win->p_coords->x - 1] = '0'; + ft_putimg(win->p_coords->x - 1, win->p_coords->y, win, 'P'); + win->c_count--; + ft_printmov(win); + } + else if (win->map[win->p_coords->y][win->p_coords->x - 1] == 'E' + && win->c_count == 0) + { + ft_printmov(win); + ft_exit(win); + } + else if (win->map[win->p_coords->y][win->p_coords->x - 1] != '1') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + ft_putimg(win->p_coords->x - 1, win->p_coords->y, win, 'P'); + ft_printmov(win); + } +} diff --git a/move_character/ft_move_left.o b/move_character/ft_move_left.o new file mode 100644 index 0000000..b62b2c1 Binary files /dev/null and b/move_character/ft_move_left.o differ diff --git a/move_character/ft_move_right.c b/move_character/ft_move_right.c new file mode 100644 index 0000000..e0be753 --- /dev/null +++ b/move_character/ft_move_right.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_move_right.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/26 15:50:32 by adjoly #+# #+# */ +/* Updated: 2024/01/26 17:44:49 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +void ft_move_right(t_window *win) +{ + if (win->p_coords->y == win->e_coords->y + && win->e_coords->x == win->p_coords->x + && win->map[win->p_coords->y][win->p_coords->x + 1] != '1') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, 'E'); + ft_putimg(win->p_coords->x + 1, win->p_coords->y, win, 'P'); + ft_printmov(win); + } + else if (win->map[win->p_coords->y][win->p_coords->x + 1] == 'C') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + win->map[win->p_coords->y][win->p_coords->x + 1] = '0'; + ft_putimg(win->p_coords->x + 1, win->p_coords->y, win, 'P'); + win->c_count--; + ft_printmov(win); + } + else if (win->map[win->p_coords->y][win->p_coords->x + 1] == 'E' + && win->c_count == 0) + { + ft_printmov(win); + ft_exit(win); + } + else if (win->map[win->p_coords->y][win->p_coords->x + 1] != '1') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + ft_putimg(win->p_coords->x + 1, win->p_coords->y, win, 'P'); + ft_printmov(win); + } +} diff --git a/move_character/ft_move_right.o b/move_character/ft_move_right.o new file mode 100644 index 0000000..7070425 Binary files /dev/null and b/move_character/ft_move_right.o differ diff --git a/move_character/ft_move_up.c b/move_character/ft_move_up.c new file mode 100644 index 0000000..658195c --- /dev/null +++ b/move_character/ft_move_up.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_move_up.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/26 15:50:35 by adjoly #+# #+# */ +/* Updated: 2024/01/26 17:46:12 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../so_long.h" + +void ft_move_up(t_window *win) +{ + if (win->map[win->p_coords->y - 1][win->p_coords->x] == 'C') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + win->map[win->p_coords->y - 1][win->p_coords->x] = '0'; + ft_putimg(win->p_coords->x, win->p_coords->y - 1, win, 'P'); + win->c_count--; + ft_printmov(win); + } + else if (win->map[win->p_coords->y - 1][win->p_coords->x] == 'C') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + win->map[win->p_coords->y - 1][win->p_coords->x] = '0'; + ft_putimg(win->p_coords->x, win->p_coords->y - 1, win, 'P'); + win->c_count--; + ft_printmov(win); + } + else if (win->map[win->p_coords->y - 1][win->p_coords->x] == 'E' + && win->c_count == 0) + { + ft_printmov(win); + ft_exit(win); + } + else if (win->map[win->p_coords->y - 1][win->p_coords->x] != '1') + { + ft_putimg(win->p_coords->x, win->p_coords->y, win, '0'); + ft_putimg(win->p_coords->x, win->p_coords->y - 1, win, 'P'); + ft_printmov(win); + } +} diff --git a/move_character/ft_move_up.o b/move_character/ft_move_up.o new file mode 100644 index 0000000..ddc3fb4 Binary files /dev/null and b/move_character/ft_move_up.o differ diff --git a/print_map.o b/print_map.o new file mode 100644 index 0000000..5740422 Binary files /dev/null and b/print_map.o differ diff --git a/printf/ft_printf.o b/printf/ft_printf.o new file mode 100644 index 0000000..5eaa2e2 Binary files /dev/null and b/printf/ft_printf.o differ diff --git a/printf/ft_putchar.o b/printf/ft_putchar.o new file mode 100644 index 0000000..e31b0fe Binary files /dev/null and b/printf/ft_putchar.o differ diff --git a/printf/ft_putnbr.o b/printf/ft_putnbr.o new file mode 100644 index 0000000..279ad48 Binary files /dev/null and b/printf/ft_putnbr.o differ diff --git a/printf/ft_putnbrbase.o b/printf/ft_putnbrbase.o new file mode 100644 index 0000000..b8ef8dc Binary files /dev/null and b/printf/ft_putnbrbase.o differ diff --git a/printf/ft_putstr.o b/printf/ft_putstr.o new file mode 100644 index 0000000..410f795 Binary files /dev/null and b/printf/ft_putstr.o differ diff --git a/printf/ft_strlen.o b/printf/ft_strlen.o new file mode 100644 index 0000000..0bbb64d Binary files /dev/null and b/printf/ft_strlen.o differ diff --git a/printf/libftprintf.a b/printf/libftprintf.a new file mode 100644 index 0000000..93ec406 Binary files /dev/null and b/printf/libftprintf.a differ diff --git a/so_long b/so_long new file mode 100755 index 0000000..6e58acd Binary files /dev/null and b/so_long differ diff --git a/so_long.h b/so_long.h index ce032b3..75107ac 100644 --- a/so_long.h +++ b/so_long.h @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/06 16:19:42 by adjoly #+# #+# */ -/* Updated: 2024/01/24 12:15:45 by adjoly ### ########.fr */ +/* Updated: 2024/01/26 16:15:23 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,6 +17,7 @@ # include "libft/libft.h" # include "get_next_line/get_next_line.h" # include "printf/ft_printf.h" + # include # include # include @@ -44,6 +45,13 @@ typedef struct s_img void *ground; } t_img; +typedef struct s_elemcount +{ + size_t p_count; + size_t c_count; + size_t e_count; +} t_elemcount; + typedef struct s_window { void *mlx; @@ -67,12 +75,55 @@ void ft_exit(t_window *win); void ft_printmap(char **map, t_window *win); void ft_putimg(size_t x, size_t y, t_window *win, char c); -void ft_check_map_error(char **map); void ft_alloc_img(t_window *win); -char ft_valid_file_ext(char *file_name); -void ft_send_error(char *msg, char **map); -void ft_check_map_error(char **map); size_t ft_mapsize(char **map); +// - Move Character - + +// move character +void ft_printmov(t_window *win); +int ft_key_event(int key, void *param); + +// move up +void ft_move_up(t_window *win); + +// move down +void ft_move_down(t_window *win); + +// move left +void ft_move_left(t_window *win); + +// move right +void ft_move_right(t_window *win); + +// - Check Error - + +// check file +char ft_check_file(char *file_name); +char ft_valid_file_ext(char *file_name); +char ft_is_empty(char **map); + +//check map content +char ft_check_reselement(t_elemcount *count); +char ft_check_element(char **map, t_coords *p_coords, t_elemcount *count); +void ft_check_map_content(char **map, t_coords *p_coords); + +// check map error +char ft_checkcol(char **map, char c, unsigned short col); +char ft_is_rectangular(char **map); +char ft_valid_char(char **map); +char ft_checkline(char *map_line, char c); +void ft_check_map_error(char **map); + +// check map state +void ft_flood(int x, int y, char **map); +char ft_floodfill(char **map, t_coords *p_coords); +char ft_is_closed(char **map); +void ft_check_map_state(char **map, t_coords *p_coords); + +// check map utils +void ft_send_error(char *msg, char **map); +char ft_check_charset(char c, char *charset); + #endif \ No newline at end of file