blob: 1e926ced9ffe5dc17928477fa15804dce7c40412 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_exit.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2020/02/02 17:19:23 by rbousset #+# ## ## #+# */
/* Updated: 2020/02/02 17:19:23 by rbousset ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include <libft.h>
#include <cub3d.h>
#include <mlx.h>
#include <stddef.h>
#include <stdlib.h>
#include <inttypes.h>
static void
ft_free_lists(t_cub *clist)
{
ft_memdel((void**)&clist->no_tex_path);
ft_memdel((void**)&clist->so_tex_path);
ft_memdel((void**)&clist->ea_tex_path);
ft_memdel((void**)&clist->we_tex_path);
ft_memdel((void**)&clist->sprite_path);
ft_memdel((void**)&clist->mapl);
ft_free_words(clist->map);
if (!clist->wlist->inited)
ft_memdel((void**)&clist->wlist->winptr);
ft_memdel((void**)&clist->wlist->wlx);
ft_memdel((void**)&clist->wlist);
ft_memdel((void**)&clist);
}
int
ft_exit(uint8_t exit_code, t_cub *clist)
{
if (clist->wlist->inited)
mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr);
ft_free_lists(clist);
ft_printf("Exiting program\n");
if (exit_code < 0 || exit_code > 0)
ft_printf("Exit code: %hhu\n", exit_code);
exit(exit_code);
return (0);
}
|