aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ft_exit.c2
-rw-r--r--src/ft_warp_level.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 477a0ec..e2a8676 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -39,7 +39,7 @@ static void
i = 0;
while (i < 2)
{
- if (clist->mlist.isweapon[i] && clist->tlist[i + 18].img)
+ if (clist->tlist[i + 18].img)
mlx_destroy_image(clist->wlist.wlx, clist->tlist[i + 18].img);
i++;
}
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 009e544..2eb165e 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -23,8 +23,6 @@
static void
ft_del_map(t_map *ml)
{
- int8_t i;
-
ft_memdel((void*)&ml->filename);
ft_memdel((void*)&ml->no_tex_path);
ft_memdel((void*)&ml->so_tex_path);
@@ -41,10 +39,6 @@ static void
ft_memdel((void*)&ml->mapl);
ft_free_sprites(ml->sprite_path);
ft_free_words(ml->map);
- i = -1;
- while (++i < 2)
- ft_memdel((void*)&clist->weaps[i]);
- ft_memdel((void*)&clist->weaps);
}
static void
@@ -90,9 +84,9 @@ static void
mlx_destroy_image(cl->wlist.wlx, cl->tlist[16].img);
if (cl->mlist.isheals && cl->tlist[17].img)
mlx_destroy_image(cl->wlist.wlx, cl->tlist[17].img);
- if (cl->mlist.isweapon[0] && cl->tlist[18].img)
+ if (cl->tlist[18].img)
mlx_destroy_image(cl->wlist.wlx, cl->tlist[18].img);
- if (cl->mlist.isweapon[1] && cl->tlist[19].img)
+ if (cl->tlist[19].img)
mlx_destroy_image(cl->wlist.wlx, cl->tlist[19].img);
if (cl->tweap[0].img)
mlx_destroy_image(cl->wlist.wlx, cl->tweap[0].img);
@@ -111,6 +105,10 @@ static void
while (++i < 8)
ft_memdel((void*)&cl->sprites[i]);
ft_memdel((void*)&cl->sprites);
+ i = -1;
+ while (++i < 2)
+ ft_memdel((void*)&cl->weaps[i]);
+ ft_memdel((void*)&cl->weaps);
}
static void
@@ -150,6 +148,8 @@ int8_t
ft_del_map(&cl->mlist);
if (ft_init_sprites(&cl->sprites) < 0)
return (-1);
+ if (ft_init_weaps(&cl->weaps) < 0)
+ return (-1);
if (ft_init_map(&cl->mlist) < 0)
return (-1);
ft_parse_map(next_path, cl);