diff options
Diffstat (limited to '')
-rw-r--r-- | src/main.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -13,20 +13,23 @@ #include <libft.h> #include <mlx.h> #include <cub3d.h> +#include <stdlib.h> int main(int argc, const char *argv[], char *const envp[]) { - t_cub clist; + t_cub *clist; if (ft_check_map_arg(argc, argv) == FT_RET_BAD_ARGV) return (FT_RET_BAD_ARGV); - if (ft_init_cub3d(&clist) < 0) + if (!(clist = (t_cub*)malloc(sizeof(t_cub)))) + return (FT_RET_ALLOC_ERR); + if (ft_init_cub3d(clist) < 0) return (FT_RET_FAILED_STRUCTS); - ft_parse_map(argv[1], &clist); - if (ft_init_winlx(&clist) < 0) - return (ft_exit(FT_RET_FAILED_MLX, &clist)); - ft_wall_tex_init(&clist); - ft_use_args(argc, argv, envp, &clist); + ft_parse_map(argv[1], clist); + if (ft_init_winlx(clist) < 0) + return (ft_exit(FT_RET_FAILED_MLX, clist)); + ft_wall_tex_init(clist); + ft_use_args(argc, argv, envp, clist); return (FT_RET_FINE); } |