-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.c
53 lines (46 loc) · 878 Bytes
/
init.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
#include "bsq.h"
t_squr *set_squr(int posX, int posY, int len)
{
t_squr *max;
max = malloc(sizeof(t_squr));
if (max)
{
max->len = len;
max->posX = posX;
max->posY = posY;
}
return (max);
}
t_obstale *add_link(t_obstale *list, int posX, int posY)
{
t_obstale *tmp;
tmp = malloc(sizeof(t_obstale));
if(tmp)
{
tmp->posX = posX;
tmp->posY = posY;
tmp->next = list;
}
return (tmp);
}
t_obstale *find_obstale(char **map, char *symbol)
{
t_obstale *list;
int i;
int j;
list = NULL;
i = 0;
while (map[i])
{
j = 0;
while (map[i][j])
{
if (map[i][j] == symbol[1])
list = add_link(list, i, j);
j += 1;
}
i += 1;
}
list = add_link(list, i, j);
return (list);
}