-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclose.c
44 lines (39 loc) · 1.4 KB
/
close.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
40
41
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* close.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: matlopes <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/28 10:37:50 by matlopes #+# #+# */
/* Updated: 2023/11/28 10:37:52 by matlopes ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void ft_error_free(char **map, char *str, char *strerror)
{
ft_free_map(map);
if (str)
free(str);
ft_error(strerror);
}
void ft_error(char *strerror)
{
ft_putstr_fd("Error\n", 2);
ft_putstr_fd(strerror, 2);
ft_putstr_fd("\n", 2);
exit(EXIT_FAILURE);
}
void ft_exit(t_game *game)
{
ft_free_map(game->map);
ft_free_images(game);
mlx_destroy_window(game->mlx, game->screen.ref);
exit(EXIT_SUCCESS);
}
int ft_close(t_game *game)
{
ft_putstr_fd("The game has been closed\n", 1);
ft_exit(game);
return (0);
}