-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathend_game.c
50 lines (44 loc) · 1.42 KB
/
end_game.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
45
46
47
48
49
50
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* end_game.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ebeiline <ebeiline@42wolfsburg.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/30 17:02:25 by ebeiline #+# #+# */
/* Updated: 2022/01/03 19:35:36 by ebeiline ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void err_func(char *str)
{
printf("\e[31m\e[1mError\n%s \e[0m \n", str);
exit (EXIT_FAILURE);
}
int end_game(t_vars *vars)
{
int i;
i = 0;
mlx_destroy_window(vars->mlx, vars->win);
free(vars->mlx);
while (i < vars->map.size.y)
{
free(vars->map.mtx[i]);
i++;
}
free(vars->map.mtx);
return (0);
}
void win_game(t_vars *vars)
{
write(1, "W!: COngrAtUlAtIOns", 20);
end_game(vars);
exit(EXIT_SUCCESS);
}
int close_game(t_vars *vars)
{
write(1, "Game aborted", 13);
end_game(vars);
exit(EXIT_SUCCESS);
return (0);
}