aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_init_map.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-03 16:14:26 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-03 16:14:26 +0100
commitce43b1cd1caa539af687425f58a6999a20807878 (patch)
tree34631aef16b6eb1d5d650fe9e900916f9810215d /src/ft_init_map.c
parentMakefile update (diff)
download42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.gz
42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.bz2
42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.xz
42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.zst
42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.zip
Going full stack is bav
Diffstat (limited to 'src/ft_init_map.c')
-rw-r--r--src/ft_init_map.c62
1 files changed, 29 insertions, 33 deletions
diff --git a/src/ft_init_map.c b/src/ft_init_map.c
index 4e8650b..a6704b6 100644
--- a/src/ft_init_map.c
+++ b/src/ft_init_map.c
@@ -18,43 +18,39 @@
static int8_t
ft_init_map_callocs(t_map *mlist)
{
- 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.nl_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
- !(mlist.nlevel_path = (char*)ft_calloc(1, sizeof(char))) ||
- !(mlist.music_path = (char*)ft_calloc(1, sizeof(char))) ||
- !(mlist.music_cmd = (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))))
+ 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->nl_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
+ !(mlist->nlevel_path = (char*)ft_calloc(1, sizeof(char))) ||
+ !(mlist->music_path = (char*)ft_calloc(1, sizeof(char))) ||
+ !(mlist->music_cmd = (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)
+int8_t
+ ft_init_map(t_map *mlist)
{
- 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;
- mlist.map_h = 0;
- mlist.x_step = 0;
- mlist.y_step = 0;
- mlist.line_chk = 0;
- mlist.map_start = 0;
- mlist.isspawn = 0;
- mlist.isnlvl = 0;
- mlist.ismusic = 0;
- mlist.scale = 0;
- mlist.nlx = 0;
- mlist.nly = 0;
- return (mlist);
+ return (-1);
+ mlist->map[1] = 0;
+ mlist->map_w = 0;
+ mlist->map_h = 0;
+ mlist->x_step = 0;
+ mlist->y_step = 0;
+ mlist->line_chk = 0;
+ mlist->map_start = 0;
+ mlist->isspawn = 0;
+ mlist->isnlvl = 0;
+ mlist->ismusic = 0;
+ mlist->scale = 0;
+ mlist->nlx = 0;
+ mlist->nly = 0;
+ return (0);
}