aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_warp_level.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-16 18:08:41 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-16 18:08:41 +0100
commit32d43e18475c967a263b5b20ad1fff728a33804a (patch)
treeff1004856b6efe5a95237731f42f8ede73431843 /src/ft_warp_level.c
parentOn the way (diff)
download42-cub3d-32d43e18475c967a263b5b20ad1fff728a33804a.tar.gz
42-cub3d-32d43e18475c967a263b5b20ad1fff728a33804a.tar.bz2
42-cub3d-32d43e18475c967a263b5b20ad1fff728a33804a.tar.xz
42-cub3d-32d43e18475c967a263b5b20ad1fff728a33804a.tar.zst
42-cub3d-32d43e18475c967a263b5b20ad1fff728a33804a.zip
in progress
Diffstat (limited to '')
-rw-r--r--src/ft_warp_level.c11
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);