diff options
author | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-02-28 15:30:41 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-02-28 15:30:41 +0100 |
commit | b9d15035f290303c2163c595098b4a70a0324ac0 (patch) | |
tree | 18c94cb1708b1112714ec729b9b0379e8556612e /src | |
parent | FIX (diff) | |
download | 42-cub3d-b9d15035f290303c2163c595098b4a70a0324ac0.tar.gz 42-cub3d-b9d15035f290303c2163c595098b4a70a0324ac0.tar.bz2 42-cub3d-b9d15035f290303c2163c595098b4a70a0324ac0.tar.xz 42-cub3d-b9d15035f290303c2163c595098b4a70a0324ac0.tar.zst 42-cub3d-b9d15035f290303c2163c595098b4a70a0324ac0.zip |
In progress
Diffstat (limited to '')
-rw-r--r-- | src/ft_exit.c | 1 | ||||
-rw-r--r-- | src/ft_init_map.c | 23 |
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); } |