diff --git a/srcs/cast_ray/utils.c b/srcs/cast_ray/utils.c index b62ed44..a7188bb 100644 --- a/srcs/cast_ray/utils.c +++ b/srcs/cast_ray/utils.c @@ -6,47 +6,12 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/02/13 23:37:02 by apommier #+# #+# */ -/* Updated: 2022/06/15 18:49:14 by apommier ### ########.fr */ +/* Updated: 2022/06/15 18:52:18 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ #include "../../includes/Cub3D.h" -// void free_texture(t_data *img) -// { -// if (img->map.texture.north) -// free(img->map.texture.north); -// if (img->map.texture.south) -// free(img->map.texture.south); -// if (img->map.texture.east) -// free(img->map.texture.east); -// if (img->map.texture.west) -// free(img->map.texture.west); -// } - -// int quit_game(t_data *img) -// { -// if (img->mlx) -// { -// if (img->mlx_win) -// mlx_destroy_window(img->mlx, img->mlx_win); -// mlx_destroy_display(img->mlx); -// free(img->mlx); -// } -// free_texture(img); -// if (img->map.simple_map) -// free(img->map.simple_map); -// if (img->to_be_free.tab) -// free_double(img->to_be_free.tab); -// if (img->to_be_free.tab_two) -// free_double(img->to_be_free.tab_two); -// if (img->to_be_free.str) -// free(img->to_be_free.str); -// if (img->to_be_free.fd != -1) -// close(img->to_be_free.fd); -// exit(1); -// } - double deg_to_rad(double angle) { return (angle * 3.14159265358979323846 / 180.0); @@ -66,3 +31,22 @@ void ft_error(char *error_msg) ft_putendl_fd(error_msg, 2); exit(1); } + +void ft_exit(char *str, t_data *img) +{ + ft_putstr_fd(str, 2); + quit_game(img); +} + +void check_dir(char *path, t_data *img) +{ + int fd; + + fd = open(path, O_DIRECTORY); + if (fd >= 0) + { + close(fd); + ft_exit("Error\nTexture path is a directory\n", img); + } + close(fd); +} diff --git a/srcs/parsing/parse_map.c b/srcs/parsing/parse_map.c index 3de6ef7..62b1296 100644 --- a/srcs/parsing/parse_map.c +++ b/srcs/parsing/parse_map.c @@ -3,34 +3,15 @@ /* ::: :::::::: */ /* parse_map.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: sadjigui +#+ +:+ +#+ */ +/* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/10 17:54:25 by sadjigui #+# #+# */ -/* Updated: 2022/06/15 17:24:27 by sadjigui ### ########.fr */ +/* Updated: 2022/06/15 18:52:15 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ #include "../../includes/Cub3D.h" -void check_dir(char *path, t_data *img) -{ - int fd; - - fd = open(path, O_DIRECTORY); - if (fd >= 0) - { - close(fd); - ft_exit("Error\nTexture path is a directory\n", img); - } - close(fd); -} - -void ft_exit(char *str, t_data *img) -{ - ft_putstr_fd(str, 2); - quit_game(img); -} - void verifie_texture_color(t_data *img) { if (img->map.texture.north == NULL)