aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-19 15:01:11 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-19 15:01:11 +0100
commitb57db1f1fcf380f18ccd99c69b21ac5679d22234 (patch)
treed4171e649f64b283d58162a88654210654d57903 /src/ft_exit.c
parentWeapons sprites do draw (diff)
download42-cub3d-b57db1f1fcf380f18ccd99c69b21ac5679d22234.tar.gz
42-cub3d-b57db1f1fcf380f18ccd99c69b21ac5679d22234.tar.bz2
42-cub3d-b57db1f1fcf380f18ccd99c69b21ac5679d22234.tar.xz
42-cub3d-b57db1f1fcf380f18ccd99c69b21ac5679d22234.tar.zst
42-cub3d-b57db1f1fcf380f18ccd99c69b21ac5679d22234.zip
ft_exit normed
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r--src/ft_exit.c26
1 files changed, 14 insertions, 12 deletions
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);
}