aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-03 16:14:26 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-03 16:14:26 +0100
commitce43b1cd1caa539af687425f58a6999a20807878 (patch)
tree34631aef16b6eb1d5d650fe9e900916f9810215d /src/ft_exit.c
parentMakefile update (diff)
download42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.gz
42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.bz2
42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.xz
42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.zst
42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.zip
Going full stack is bav
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r--src/ft_exit.c68
1 files changed, 32 insertions, 36 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 6622eb1..1be7a32 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -21,52 +21,48 @@
static void
ft_free_lists(t_cub *clist)
{
- 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.sprite_path);
- ft_memdel((void**)&clist.mlist.nl_tex_path);
- ft_memdel((void**)&clist.mlist.nlevel_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.mlist);
- ft_memdel((void**)&clist.plist);
- if (!clist.wlist.inited)
- ft_memdel((void**)&clist.wlist.winptr);
- ft_memdel((void**)&clist.wlist);
- ft_memdel((void**)&clist);
+ 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.sprite_path);
+ ft_memdel((void**)&clist->mlist.nl_tex_path);
+ ft_memdel((void**)&clist->mlist.nlevel_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);
+ if (!clist->wlist.inited)
+ ft_memdel((void**)&clist->wlist.winptr);
}
int
ft_exit(uint8_t exit_code, t_cub *clist)
{
- if (clist.walltexgood)
+ if (clist->walltexgood)
{
- if (clist.tlist[0].img)
- mlx_destroy_image(clist.wlist.wlx, clist.tlist[0].img);
- if (clist.tlist[1].img)
- mlx_destroy_image(clist.wlist.wlx, clist.tlist[1].img);
- if (clist.tlist[2].img)
- mlx_destroy_image(clist.wlist.wlx, clist.tlist[2].img);
- if (clist.tlist[3].img)
- mlx_destroy_image(clist.wlist.wlx, clist.tlist[3].img);
- if (clist.tlist[4].img)
- mlx_destroy_image(clist.wlist.wlx, clist.tlist[4].img);
- if (clist.mlist.isnlvl && clist.tlist[5].img)
- mlx_destroy_image(clist.wlist.wlx, clist.tlist[5].img);
+ if (clist->tlist[0].img)
+ mlx_destroy_image(clist->wlist.wlx, clist->tlist[0].img);
+ if (clist->tlist[1].img)
+ mlx_destroy_image(clist->wlist.wlx, clist->tlist[1].img);
+ if (clist->tlist[2].img)
+ mlx_destroy_image(clist->wlist.wlx, clist->tlist[2].img);
+ if (clist->tlist[3].img)
+ mlx_destroy_image(clist->wlist.wlx, clist->tlist[3].img);
+ if (clist->tlist[4].img)
+ mlx_destroy_image(clist->wlist.wlx, clist->tlist[4].img);
+ if (clist->mlist.isnlvl && clist->tlist[5].img)
+ mlx_destroy_image(clist->wlist.wlx, clist->tlist[5].img);
}
- if (clist.wlist.inited)
+ if (clist->wlist.inited)
{
- mlx_destroy_window(clist.wlist.wlx, clist.wlist.winptr);
- clist.wlist.winptr = NULL;
+ mlx_destroy_window(clist->wlist.wlx, clist->wlist.winptr);
+ clist->wlist.winptr = NULL;
}
- if (clist.isoldmus && clist.wlist.inited)
+ if (clist->isoldmus && clist->wlist.inited)
{
- pthread_cancel(clist.tid);
- pthread_join(clist.tid, NULL);
+ pthread_cancel(clist->tid);
+ pthread_join(clist->tid, NULL);
}
ft_free_lists(clist);
ft_printf("Exiting program\n");