aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_init_map.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-12 23:47:37 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-12 23:47:37 +0100
commita2f0bde9da402ddfd47ec54d42b83585c3296ebf (patch)
treeff99c82f9a31064617953607eacd56fd1a862827 /src/ft_init_map.c
parentSecured traps (diff)
download42-cub3d-a2f0bde9da402ddfd47ec54d42b83585c3296ebf.tar.gz
42-cub3d-a2f0bde9da402ddfd47ec54d42b83585c3296ebf.tar.bz2
42-cub3d-a2f0bde9da402ddfd47ec54d42b83585c3296ebf.tar.xz
42-cub3d-a2f0bde9da402ddfd47ec54d42b83585c3296ebf.tar.zst
42-cub3d-a2f0bde9da402ddfd47ec54d42b83585c3296ebf.zip
Secured parsing
Diffstat (limited to 'src/ft_init_map.c')
-rw-r--r--src/ft_init_map.c23
1 files changed, 16 insertions, 7 deletions
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
@@ -57,12 +57,27 @@ static int8_t
}
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)
{
if (ft_init_map_callocs(mlist) < 0)
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));
}