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
43
44
45
46
47
48
49
50
|
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_check_missing.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2020/02/02 17:19:12 by rbousset #+# ## ## #+# */
/* Updated: 2020/02/02 17:19:13 by rbousset ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include <libft.h>
#include <cub3d.h>
#include <unistd.h>
int
ft_missing_error(const char *err, t_cub *clist)
{
ft_dprintf(STDERR_FILENO, "Error\n");
ft_dprintf(STDERR_FILENO,
"\033[1;31mMissing element: %s\033[0m\n", err);
return (ft_exit(1, clist));
}
int
ft_check_missing(t_cub *clist)
{
ft_printf("[%d], [%d], [%d]\n", clist->f_rgb.r, clist->f_rgb.g, clist->f_rgb.b);
if (!clist->no_tex_path[0])
return (ft_missing_error("north side texture", clist));
else if (!clist->so_tex_path[0])
return (ft_missing_error("south side texture", clist));
else if (!clist->ea_tex_path[0])
return (ft_missing_error("east side texture", clist));
else if (!clist->we_tex_path[0])
return (ft_missing_error("west side texture", clist));
else if (!clist->sprite_path[0])
return (ft_missing_error("sprite texture", clist));
else if (clist->wlist->x_size == 0 || clist->wlist->y_size == 0)
return (ft_missing_error("resolution", clist));
else if (clist->f_rgb.r == -1 || clist->f_rgb.g == -1 || clist->f_rgb.b == -1)
return (ft_missing_error("floor color", clist));
else if (clist->c_rgb.r == -1 || clist->c_rgb.g == -1 || clist->c_rgb.b == -1)
return (ft_missing_error("ceiling color", clist));
else if (clist->plist->pos_x == 0 || clist->plist->pos_y == 0)
return (ft_missing_error("player spawn", clist));
return (0);
}
|