From 32d43e18475c967a263b5b20ad1fff728a33804a Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 16 Mar 2020 18:08:41 +0100 Subject: in progress --- src/ft_exit.c | 2 +- src/ft_warp_level.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ft_exit.c b/src/ft_exit.c index d135433..4551e2f 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -21,7 +21,7 @@ #include static void -ft_free_some_extras(t_cub *clist) + ft_free_some_extras(t_cub *clist) { uint8_t i; diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c index 56d4d67..7259275 100644 --- a/src/ft_warp_level.c +++ b/src/ft_warp_level.c @@ -51,12 +51,11 @@ static void cl->f_rgb = ft_init_rgb(); cl->c_rgb = ft_init_rgb(); cl->rlist = ft_init_s_ray(); - i = 0; - while (i < 5) + i = -1; + while (++i < 5) { mlx_destroy_image(cl->wlist.wlx, cl->tlist[i].img); cl->tlist[i].ptr = NULL; - i++; } if (cl->mlist.isnlvl && cl->tlist[5].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[5].img); @@ -67,6 +66,10 @@ static void if (cl->mlist.istraps && cl->tlist[15].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[15].img); ft_del_extra_sprites(cl); + i = -1; + while (++i < 8) + ft_memdel((void**)&cl->sprites[i]); + ft_memdel((void**)&cl->sprites); } static void @@ -104,6 +107,8 @@ int8_t tmp_mup = ft_strdup(cl->mlist.music_path); ft_del_some(cl); ft_del_map(&cl->mlist); + if (!(cl->sprites = ft_init_sprites())) + return (-1); if (ft_init_map(&cl->mlist) < 0) return (-1); ft_parse_map(next_path, cl); -- cgit v1.2.3