aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_init_map.c
blob: 0bbae5e91d7a089a7e847a530d72f4db5b0554a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <libft.h>
#include <cub3d.h>
#include <stdlib.h>

t_map
	*ft_init_map(void)
{
	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->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 (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->scale = 0;
	return (mlist);
}