From a2f0bde9da402ddfd47ec54d42b83585c3296ebf Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 12 Mar 2020 23:47:37 +0100 Subject: Secured parsing --- src/ft_init_map.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/ft_init_map.c') diff --git a/src/ft_init_map.c b/src/ft_init_map.c index 8f6bb3d..813a795 100644 --- a/src/ft_init_map.c +++ b/src/ft_init_map.c @@ -56,6 +56,19 @@ static int8_t return (0); } +int8_t + ft_init_map_norme(t_map *mlist) +{ + mlist->scale = 0; + mlist->nlx = 0; + mlist->nly = 0; + mlist->sprite_var = 0; + mlist->topsp = 0; + ft_bzero(mlist->sprite_order, 4096); + ft_bzero(mlist->traps_order, 512); + return (0); +} + int8_t ft_init_map(t_map *mlist) { @@ -63,6 +76,8 @@ int8_t return (-1); mlist->map[1] = 0; mlist->mcmd_words[1] = 0; + if (ft_calloc_sprites(mlist) < 0) + return (-1); mlist->map_w = 0; mlist->map_h = 0; mlist->mapl_len = 0; @@ -80,11 +95,5 @@ int8_t mlist->sprite_nbr = 0; mlist->traps_nbr = 0; mlist->darklvl = 0; - mlist->scale = 0; - mlist->nlx = 0; - mlist->nly = 0; - mlist->sprite_var = 0; - ft_bzero(mlist->sprite_order, 4096); - ft_bzero(mlist->traps_order, 512); - return (ft_calloc_sprites(mlist)); + return (ft_init_map_norme(mlist)); } -- cgit v1.2.3