aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p6.le-101.fr>2020-03-05 15:59:52 +0100
committerRudy Bousset <rbousset@z2r5p6.le-101.fr>2020-03-05 15:59:52 +0100
commit3a346b70624949dcf7f4bec385c840441c6e3e31 (patch)
treeca47ed855d8464c35cc5ef892d120391bf1314ec /src/ft_exit.c
parentPretty cool (diff)
download42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.tar.gz
42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.tar.bz2
42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.tar.xz
42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.tar.zst
42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.zip
Get normed
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r--src/ft_exit.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index a63d600..ca5201c 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -38,24 +38,28 @@ static void
ft_memdel((void**)&clist->wlist.winptr);
}
+static void
+ ft_del_tex(t_cub *clist)
+{
+ 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);
+}
+
int
ft_exit(uint8_t exit_code, t_cub *clist)
{
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);
- }
+ ft_del_tex(clist);
if (clist->wlist.inited)
{
mlx_destroy_window(clist->wlist.wlx, clist->wlist.winptr);