-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfree.c
37 lines (33 loc) · 1.24 KB
/
free.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jchapell <jchapell@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/30 23:05:41 by jchapell #+# #+# */
/* Updated: 2023/06/01 18:39:35 by jchapell ### ########.fr */
/* */
/* ************************************************************************** */
#include "inc/proto.h"
void free_matrix(int max, char **matrix)
{
int i;
i = -1;
if (!matrix)
return ;
while (++i < max)
free(matrix[i]);
free(matrix);
}
void free_level(t_level *l)
{
free_matrix(l->data.size.y, l->map_matrix);
free(l->name);
free(l->map);
free(l->map_c);
if (l->nb_col > 0)
free(l->collision_map);
if (l->nb_en > 0)
free(l->enemy_map);
}