-
Notifications
You must be signed in to change notification settings - Fork 0
/
exit.c
39 lines (37 loc) · 1.43 KB
/
exit.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bmacmaho <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/18 23:15:52 by barramacmah #+# #+# */
/* Updated: 2023/07/08 15:46:39 by bmacmaho ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
int ft_clean_exit(int stat, t_cub *cub)
{
if (stat > 2)
{
if (cub->map.east)
mlx_delete_image(cub->mlx, cub->map.east);
if (cub->map.west)
mlx_delete_image(cub->mlx, cub->map.west);
if (cub->map.north)
mlx_delete_image(cub->mlx, cub->map.north);
if (cub->map.south)
mlx_delete_image(cub->mlx, cub->map.south);
}
if (stat > 0 && cub->img)
mlx_delete_image(cub->mlx, cub->img);
if (stat == 10)
{
if (cub->mlx)
mlx_close_window(cub->mlx);
mlx_terminate(cub->mlx);
}
if (stat >= 0)
free_map(&cub->map);
exit (0);
}