aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r--src/ft_exit.c61
1 files changed, 38 insertions, 23 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index c3b5ebf..61f925e 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -19,33 +19,48 @@
#include <pthread.h>
static void
+ ft_free_some_extras(t_cub *clist)
+{
+ uint8_t i;
+
+ i = 0;
+ while (i < 8)
+ {
+ ft_memdel((void*)&clist->sprites[i]);
+ i++;
+ }
+ ft_memdel((void*)&clist->sprites);
+ ft_memdel((void*)&clist);
+}
+
+static void
ft_free_lists(t_cub *clist)
{
- ft_memdel((void**)&clist->mlist.filename);
- ft_memdel((void**)&clist->mlist.no_tex_path);
- ft_memdel((void**)&clist->mlist.so_tex_path);
- ft_memdel((void**)&clist->mlist.ea_tex_path);
- ft_memdel((void**)&clist->mlist.we_tex_path);
- ft_memdel((void**)&clist->mlist.nl_tex_path);
- ft_memdel((void**)&clist->mlist.fl_tex_path);
- ft_memdel((void**)&clist->mlist.ce_tex_path);
- ft_memdel((void**)&clist->mlist.nlevel_path);
- ft_memdel((void**)&clist->mlist.skybox_path);
- ft_memdel((void**)&clist->mlist.traps_path);
- ft_memdel((void**)&clist->mlist.music_path);
- ft_memdel((void**)&clist->mlist.music_cmd);
- ft_memdel((void**)&clist->mlist.mapl);
+ ft_memdel((void*)&clist->mlist.filename);
+ ft_memdel((void*)&clist->mlist.no_tex_path);
+ ft_memdel((void*)&clist->mlist.so_tex_path);
+ ft_memdel((void*)&clist->mlist.ea_tex_path);
+ ft_memdel((void*)&clist->mlist.we_tex_path);
+ ft_memdel((void*)&clist->mlist.nl_tex_path);
+ ft_memdel((void*)&clist->mlist.fl_tex_path);
+ ft_memdel((void*)&clist->mlist.ce_tex_path);
+ ft_memdel((void*)&clist->mlist.nlevel_path);
+ ft_memdel((void*)&clist->mlist.skybox_path);
+ ft_memdel((void*)&clist->mlist.traps_path);
+ ft_memdel((void*)&clist->mlist.music_path);
+ ft_memdel((void*)&clist->mlist.music_cmd);
+ ft_memdel((void*)&clist->mlist.mapl);
ft_free_words(clist->mlist.map);
- ft_memdel((void**)&clist->sfx.death);
- ft_memdel((void**)&clist->sfx.footstep_one);
- ft_memdel((void**)&clist->sfx.footstep_two);
- ft_memdel((void**)&clist->sfx.new_lvl);
- ft_memdel((void**)&clist->sfx.pain_one);
- ft_memdel((void**)&clist->sfx.pain_two);
- ft_memdel((void**)&clist->sfx.trap);
+ ft_memdel((void*)&clist->sfx.death);
+ ft_memdel((void*)&clist->sfx.footstep_one);
+ ft_memdel((void*)&clist->sfx.footstep_two);
+ ft_memdel((void*)&clist->sfx.new_lvl);
+ ft_memdel((void*)&clist->sfx.pain_one);
+ ft_memdel((void*)&clist->sfx.pain_two);
+ ft_memdel((void*)&clist->sfx.trap);
ft_free_sprites(clist->mlist.sprite_path);
if (!clist->wlist.inited)
- ft_memdel((void**)&clist->wlist.winptr);
+ ft_memdel((void*)&clist->wlist.winptr);
}
static void
@@ -107,10 +122,10 @@ int
if (FT_OS == 1)
mlx_destroy_image(clist->wlist.wlx, clist->img.img);
mlx_destroy_window(clist->wlist.wlx, clist->wlist.winptr);
- clist->wlist.winptr = NULL;
}
ft_cancel_threads(clist);
ft_free_lists(clist);
+ ft_free_some_extras(clist);
ft_printf("Exiting program\n");
exit(exit_code);
return (0);