#include #include #include #include #include #include static void ft_free_lists(t_cub *clist) { ft_memdel(clist->no_tex_path); ft_memdel(clist->so_tex_path); ft_memdel(clist->ea_tex_path); ft_memdel(clist->we_tex_path); ft_memdel(clist->sprite_path); ft_free_words(clist->map); /* if (!clist->wlist->inited) */ ft_memdel(clist->wlist->winptr); ft_memdel(clist->wlist->wlx); ft_memdel(clist->wlist); ft_memdel(clist); } int ft_exit(uint8_t exit_code, t_cub *clist) { if (clist->wlist->inited) { mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr); clist->wlist->winptr = NULL; } ft_printf("Exiting program\n"); if (exit_code < 0 || exit_code > 0) ft_printf("Exit code: %hhu\n", exit_code); ft_free_lists(clist); exit(exit_code); return (0); }