-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.c
More file actions
71 lines (65 loc) · 1.16 KB
/
Copy pathcheck.c
File metadata and controls
71 lines (65 loc) · 1.16 KB
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
70
71
/*
** check.c for tetris in /home/thibrex/Dropbox/delivery/PSU/PSU_2016_tetris
**
** Made by Thibaut Cornolti
** Login <thibaut.cornolti@epitech.eu>
**
** Started on Fri Mar 17 13:40:26 2017 Thibaut Cornolti
** Last update Sun Mar 19 23:43:06 2017 Thibaut Cornolti
*/
#include <stdlib.h>
#include "tetris.h"
static void check_pars_tab(char **pars)
{
int i;
int j;
i = -1;
while (++i < 6)
{
j = -1;
while (++j < 6)
{
if (j == i)
continue ;
if (!my_strcmp(pars[i], pars[j]))
{
my_puterror("Parsing error.\n");
exit(84);
}
}
}
}
void check_pars(t_pars *p)
{
char *pars[6];
pars[0] = p->kl;
pars[1] = p->kr;
pars[2] = p->kt;
pars[3] = p->kd;
pars[4] = p->kq;
pars[5] = p->kp;
check_pars_tab(pars);
}
void check_game(t_shapes *s, t_pars *p, int i)
{
if (!s)
{
my_puterror("Not enough tetriminos!\n");
non_block(0, 0);
exit(84);
}
if (i)
{
while (s->name)
{
if (s->valide &&
s->height <= p->row &&
s->width <= p->col)
return ;
s += 1;
}
my_puterror("Not enough tetriminos!\n");
non_block(0, 0);
exit(84);
}
}