From b57db1f1fcf380f18ccd99c69b21ac5679d22234 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 19 Mar 2020 15:01:11 +0100 Subject: ft_exit normed --- src/ft_exit.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ft_exit.c b/src/ft_exit.c index 91f1c4f..d140739 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -29,6 +29,20 @@ static void ft_memdel((void*)&clist->sprites[i]); i++; } + i = 0; + while (i < 4) + { + if (clist->tweap[i].img) + mlx_destroy_image(clist->wlist.wlx, clist->tweap[i].img); + i++; + } + i = 0; + while (i < 2) + { + if (clist->mlist.isweapon[i] && clist->tlist[i + 18].img) + mlx_destroy_image(clist->wlist.wlx, clist->tlist[i + 18].img); + i++; + } ft_memdel((void*)&clist->sprites); ft_memdel((void*)&clist); } @@ -88,18 +102,6 @@ static void mlx_destroy_image(clist->wlist.wlx, clist->tlist[16].img); if (clist->mlist.isheals && clist->tlist[17].img) mlx_destroy_image(clist->wlist.wlx, clist->tlist[17].img); - if (clist->mlist.isweapon[0] && clist->tlist[18].img) - mlx_destroy_image(clist->wlist.wlx, clist->tlist[18].img); - if (clist->mlist.isweapon[1] && clist->tlist[19].img) - mlx_destroy_image(clist->wlist.wlx, clist->tlist[19].img); - if (clist->tweap[0].img) - mlx_destroy_image(clist->wlist.wlx, clist->tweap[0].img); - if (clist->tweap[1].img) - mlx_destroy_image(clist->wlist.wlx, clist->tweap[1].img); - if (clist->tweap[2].img) - mlx_destroy_image(clist->wlist.wlx, clist->tweap[2].img); - if (clist->tweap[3].img) - mlx_destroy_image(clist->wlist.wlx, clist->tweap[3].img); ft_del_extra_sprites(clist); } -- cgit v1.2.3