-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame_close.c
More file actions
66 lines (59 loc) · 1.6 KB
/
game_close.c
File metadata and controls
66 lines (59 loc) · 1.6 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* game_close.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jcorral- <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/03/03 10:09:32 by jcorral- #+# #+# */
/* Updated: 2020/03/03 13:34:26 by jcorral- ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void liberate_parse(t_m *s)
{
if (s->parser.s_t)
free(s->parser.s_t);
if (s->parser.n_t)
free(s->parser.n_t);
if (s->parser.w_t)
free(s->parser.w_t);
if (s->parser.e_t)
free(s->parser.e_t);
if (s->parser.spr_t)
free(s->parser.spr_t);
}
void liberate_map(t_m *s)
{
int i;
i = 0;
while (i < s->parser.mapwidth)
{
free(s->parser.worldmap[i]);
i++;
}
free(s->parser.worldmap);
}
void exit_game(t_m *s)
{
free(s->spr.p);
free(s->spr.zbuff);
free(s->spr.spriteo);
free(s->spr.sprited);
liberate_parse(s);
liberate_map(s);
exit(0);
}
void invalid_map(char *msg)
{
int i;
write(1, "Error\n", 6);
i = 0;
while (msg[i] != 0)
{
write(1, &msg[i], 1);
i++;
}
write(1, "\n", 1);
exit(0);
}