mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
Added frees for the mapdata structure
This commit is contained in:
parent
9ba3771ebf
commit
977385492b
1 changed files with 22 additions and 2 deletions
24
src/main.c
24
src/main.c
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/06 13:16:11 by tchampio #+# #+# */
|
/* Created: 2025/05/06 13:16:11 by tchampio #+# #+# */
|
||||||
/* Updated: 2025/06/16 16:12:50 by tchampio ### ########.fr */
|
/* Updated: 2025/06/20 23:58:56 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -36,9 +36,29 @@ void my_mlx_pixel_put(t_mlx_data *data, int x, int y, int color)
|
||||||
*(unsigned int*)dst = color;
|
*(unsigned int*)dst = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_tab(char **tab)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!tab)
|
||||||
|
return ;
|
||||||
|
i = 0;
|
||||||
|
while (tab[i])
|
||||||
|
{
|
||||||
|
free(tab[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
free(tab);
|
||||||
|
}
|
||||||
int destroy(t_mapdata *map)
|
int destroy(t_mapdata *map)
|
||||||
{
|
{
|
||||||
(void)map;
|
free_tab(map->map);
|
||||||
|
free_tab(map->mapflood);
|
||||||
|
free(map->EA_texture);
|
||||||
|
free(map->NO_texture);
|
||||||
|
free(map->SO_texture);
|
||||||
|
free(map->WE_texture);
|
||||||
|
free(map->filename);
|
||||||
exit(0);
|
exit(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue