-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallcontrols.c
69 lines (62 loc) · 1.59 KB
/
wallcontrols.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* wallcontrols.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: farpacik <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/15 13:44:37 by farpacik #+# #+# */
/* Updated: 2022/12/15 13:47:58 by farpacik ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void wallcontrol3(t_data *data)
{
int len;
int leny;
leny = data->leny;
len = ft_strlen(data->maps[leny - 2]);
leny--;
while (leny)
{
if (data->maps[leny][len - 2] == '1' && data->maps[leny][0] == '1')
leny--;
else
{
ft_printf("ERROR\n");
exit(1);
}
}
}
void wallcontrol(t_data *data)
{
int i;
int c;
i = 0;
c = 0;
while (data->maps[i][c] != '\0')
{
if (data->maps[i][c] == '1' || data->maps[i][c] == '\n')
c++;
else
{
ft_printf("ERROR");
exit(1);
}
}
}
void wallcontrol2(t_data *data)
{
int c;
c = 0;
while (data->maps[data->leny - 1][c] != '\0')
{
if (data->maps[data->leny - 1][c] == '1')
c++;
else
{
ft_printf("ERROR");
exit(1);
}
}
}