diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_warp_level.c | 11 |
1 files changed, 8 insertions, 3 deletions
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); |