-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_check_data.c
executable file
·70 lines (63 loc) · 1.66 KB
/
ft_check_data.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_check_data.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dzui <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/08/10 21:16:50 by dzui #+# #+# */
/* Updated: 2017/08/10 21:16:52 by dzui ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
int ft_check_dupliactes(t_room *head)
{
t_room *current;
t_room *start;
current = head;
while (current)
{
start = current->next;
while (start)
{
if (ft_strequ(current->name, start->name)
|| (current->x == start->x && current->y == start->y))
return (0);
start = start->next;
}
current = current->next;
}
return (1);
}
int ft_check_start_end(t_room *head)
{
t_room *current;
int start;
int end;
start = 0;
end = 0;
current = head;
while (current)
{
if (current->start == 1)
start = 1;
if (current->end == 1)
end = 1;
current = current->next;
}
if (!start || !end)
return (0);
return (1);
}
int ft_check_number(char *data)
{
int i;
i = 0;
while (data[i])
{
if (!ft_isdigit(data[i]))
return (0);
i++;
}
return (1);
}