-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_check_c.c
90 lines (81 loc) · 1.84 KB
/
ft_check_c.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_check_c.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sbourziq <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/12 21:48:03 by sbourziq #+# #+# */
/* Updated: 2024/03/12 21:48:13 by sbourziq ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
int ft_check_c(t_mlx *data)
{
int i;
int j;
i = 0;
j = 0;
while (data->str[i])
{
j = 0;
while (data->str[i][j])
{
if (data->str[i][j] == 'C')
{
return (0);
}
j++;
}
i++;
}
return (1);
}
void ft_sam_number(t_node *width)
{
int check;
check = 0;
while (width->next != NULL)
{
if (width->data == width->next->data)
width = width->next;
else
{
ft_printf("error in your map(morre line)\n");
exit(1);
}
}
}
int ft_check_char(char *str, char c)
{
int i;
int j;
i = 0;
j = 0;
while (str[j] != '\0')
{
if (str[j] == c)
i++;
if (str[j] != '1' && str[j] != '0' && str[j] != 'C' && str[j] != 'P'
&& str[j] != 'E' && str[j] != 'N' && str[j] != '\n')
{
ft_printf("error, bad characters\n");
free(str);
exit(1);
}
j++;
}
return (i);
}
int check_number(char *res)
{
int i;
i = 0;
while (res[i] != '\n' && res[i] != '\0')
{
if (res[i] != '1')
return (1);
i++;
}
return (0);
}