aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_init_lists.c
blob: 3554e5e012ac859204d2345a59d13eaa8fb5aa89 (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
32
33
34
35
36
37
38
39
40
41
42
#include <libft.h>
#include <mlx.h>
#include <cub3d.h>
#include <stddef.h>
#include <stdlib.h>

t_win
*ft_init_win(void)
{
	t_win	*wlist;

	if (!(wlist = (t_win*)malloc(sizeof(t_win))))
		return (NULL);
	if (!(wlist->wlx = ft_calloc(1, 1)) ||
		!(wlist->winptr = ft_calloc(1, 1)))
		return (NULL);
	return (wlist);
}

t_cub
*ft_init_cub(void)
{
	t_cub	*clist;

	if (!(clist = (t_cub*)malloc(sizeof(t_cub))))
		return (NULL);
	if (!(clist->no_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
		!(clist->so_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
		!(clist->ea_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
		!(clist->we_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
		!(clist->sprite_path = (char*)ft_calloc(1, sizeof(char))))	
		return (NULL);
	clist->f_color = 0;
	clist->c_color = 0;
	if (!(clist->map = (char**)ft_calloc(2, sizeof(char*))))
		return (NULL);
	if (!(clist->map[0] = (char*)ft_calloc(1, sizeof(char))))
		return (NULL);
	clist->map[1] = 0;
	clist->map_width = 0;
	return (clist);
}