-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.c
33 lines (28 loc) · 1.26 KB
/
utils.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: juazouz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/24 12:59:46 by juazouz #+# #+# */
/* Updated: 2018/11/26 13:30:56 by juazouz ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
t_tetriminos *cell_at(t_grid *grid, int x, int y)
{
return (grid->cells[x + grid->size * y]);
}
void set_cell_at(t_grid *grid, int x, int y, t_tetriminos *val)
{
(grid->cells[x + grid->size * y]) = val;
}
int cells_count(t_grid *grid)
{
return (grid->size * grid->size);
}
int distance(t_point *a, t_point *b)
{
return (ft_abs(a->x - b->x) + ft_abs(a->y - b->y));
}