-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpars_utils.c
61 lines (54 loc) · 1.64 KB
/
pars_utils.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
59
60
61
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pars_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lbrandy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/13 16:33:30 by lbrandy #+# #+# */
/* Updated: 2021/04/03 12:03:18 by lbrandy ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void skip_spaces(char **s)
{
int count;
count = 0;
while ((**s == ' ' || **s == '\t' || **s == '+') && **s)
{
if (count == 1 && !ft_isdigit(**s))
error_handler("trash in file\n");
if (**s == '+')
count++;
(*s)++;
}
}
void check_trash_str(char *s, t_textures *t)
{
while (*s)
{
if (*s != ' ' && check_full_struct(t))
error_handler("trash in file\n");
else if (*s != ' ' && !check_full_struct(t))
error_handler("bad keys\n");
s++;
}
}
void ft_lstfree_cont(void *content)
{
if (content)
free(content);
}
void ft_filling_map(t_list *list, t_all *all, int count)
{
int i;
i = 0;
while (i < count)
{
all->map[i] = ft_strdup(list->content);
if (!all->map[i])
error_handler("malloc error\n");
list = list->next;
i++;
}
}