-
Notifications
You must be signed in to change notification settings - Fork 0
/
stuff.c
58 lines (51 loc) · 957 Bytes
/
stuff.c
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
51
52
53
54
55
56
57
58
#include "hdrs/cub3d.h"
float ABS(float a)
{
if (a < 0)
return (-1 * a);
return (a);
}
int digits_in_str(const char *str)
{
int i;
i = 0;
while (str[i])
{
if (!ft_isdigit(str[i]) && str[i] != ' ')
return (0);
i++;
}
return (1);
}
int dp_len(char **strs)
{
int i;
i = 0;
while (strs[i] != NULL)
i++;
return (i);
}
void full_map_init(t_cub_map *full_map)
{
full_map->res.x = 0;
full_map->res.y = 0;
full_map->fl_c.flag = 0;
full_map->cl_c.flag = 0;
full_map->map = NULL;
full_map->n_t = NULL;
full_map->e_t = NULL;
full_map->s_t = NULL;
full_map->w_t = NULL;
full_map->s = NULL;
}
int check_all_fields(t_cub_map *full_map)
{
if (full_map->res.x == 0 || full_map->res.y == 0
|| full_map->cl_c.flag == 0
|| full_map->s == NULL || full_map->fl_c.flag == 0
|| full_map->w_t == NULL
|| full_map->s_t == NULL || full_map->e_t == NULL
|| full_map->n_t == NULL || full_map->map == NULL)
return (0);
return (1);
}