-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_tet_extra.c
69 lines (64 loc) · 1.62 KB
/
ft_tet_extra.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_tet_extra.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ffoissey <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/28 13:13:03 by ffoissey #+# #+# */
/* Updated: 2018/11/29 16:19:15 by ffoissey ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
void ft_init_tet(t_tet *tet)
{
unsigned char i;
unsigned char j;
unsigned char k;
i = 0;
while (i < 26)
{
j = 0;
while (j < 4)
{
k = 0;
while (k < 4)
tet[i].p[j][k++] = '.';
tet[i].p[j++][k] = '\0';
}
tet[i].spe = 0;
tet[i].nb = 0;
tet[i].l = 'A' + i;
tet[i].heigth = 4;
tet[i].width = 4;
tet[i].l_max = 0;
tet[i].c_max = 0;
i++;
}
}
void ft_area(t_tet *tet, unsigned char i)
{
short l;
short c;
short c_max;
short l_max;
l = -1;
c_max = 1;
l_max = 1;
while (++l < 4)
{
c = -1;
while (++c < 4)
{
if (tet[i].p[l][c] != '.')
{
if ((c + 1) > c_max)
c_max = c + 1;
if ((l + 1) > l_max)
l_max = l + 1;
}
}
}
tet[i].c_max = c_max;
tet[i].l_max = l_max;
}