aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_exit.c1
-rw-r--r--src/ft_init_map.c23
2 files changed, 18 insertions, 6 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index b9e061f..97671d6 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -25,6 +25,7 @@ static void
ft_memdel((void**)&clist->mlist->ea_tex_path);
ft_memdel((void**)&clist->mlist->we_tex_path);
ft_memdel((void**)&clist->mlist->sprite_path);
+ ft_memdel((void**)&clist->mlist->nlevel_path);
ft_memdel((void**)&clist->mlist->mapl);
ft_free_words(clist->mlist->map);
ft_memdel((void**)&clist->mlist);
diff --git a/src/ft_init_map.c b/src/ft_init_map.c
index cc767f6..0eb2ab2 100644
--- a/src/ft_init_map.c
+++ b/src/ft_init_map.c
@@ -13,22 +13,32 @@
#include <libft.h>
#include <cub3d.h>
#include <stdlib.h>
+#include <stdint.h>
-t_map
- *ft_init_map(void)
+static int8_t
+ ft_init_map_callocs(t_map *mlist)
{
- t_map *mlist;
-
- if (!(mlist = (t_map*)malloc(sizeof(t_map))))
- return (NULL);
if (!(mlist->no_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->so_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->ea_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->we_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->sprite_path = (char*)ft_calloc(1, sizeof(char))) ||
+ !(mlist->nlevel_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->mapl = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->map = (char**)ft_calloc(2, sizeof(char*))) ||
!(mlist->map[0] = (char*)ft_calloc(1, sizeof(char))))
+ return (-1);
+ return (0);
+}
+
+t_map
+ *ft_init_map(void)
+{
+ t_map *mlist;
+
+ if (!(mlist = (t_map*)malloc(sizeof(t_map))))
+ return (NULL);
+ if (ft_init_map_callocs(mlist) < 0)
return (NULL);
mlist->map[1] = 0;
mlist->map_w = 0;
@@ -38,6 +48,7 @@ t_map
mlist->line_chk = 0;
mlist->map_start = 0;
mlist->isspawn = 0;
+ mlist->isnlvl = 0;
mlist->scale = 0;
return (mlist);
}