-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_cordis.c
60 lines (55 loc) · 1.6 KB
/
save_cordis.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* save_cordis.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zszeredi <zszeredi@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/01 14:54:42 by zszeredi #+# #+# */
<<<<<<< HEAD
/* Updated: 2020/02/25 13:38:01 by zszeredi ### ########.fr */
=======
/* Updated: 2020/02/22 18:42:43 by aben-azz ### ########.fr */
>>>>>>> 013b98f415153171ca627e0bde26d963b20acdb3
/* */
/* ************************************************************************** */
#include "fillit.h"
t_c_var declare(t_c_var *p)
{
p->i = 0;
p->counter = 0;
return (*p);
}
t_tetra cordi(t_tetra s, t_c_var *p)
{
s.cordis[p->counter].x = p->j;
s.cordis[p->counter].y = p->i;
return (s);
}
void save_cordis(t_tetra **s, int nb)
{
t_c_var *p;
t_tetra *xd;
xd = *s;
p = malloc(sizeof(t_c_var));
p->m = 0;
while (p->m < nb - 1)
{
*p = declare(p);
while (p->i < 4)
{
p->j = 0;
while (p->j < 4)
{
if (xd[p->m].tab[p->i][p->j] == 1)
{
xd[p->m] = cordi(xd[p->m], p);
p->counter++;
}
p->j++;
}
p->i++;
}
p->m++;
}
}