aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}