-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_error.c
50 lines (47 loc) · 1.63 KB
/
ft_error.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_error.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: atabiti <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/21 11:33:19 by atabiti #+# #+# */
/* Updated: 2022/03/25 11:54:03 by atabiti ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void ft_errors_1(struct s_s2 *a)
{
if (a->collectible < 1)
{
write(2, "\nError NO COLLECTIBLE\n", 22);
ft_free(a->exactarray, a->to_free + 1);
exit(1);
}
if (a->starting_pos < 1)
{
write(2, "\nError NO STARTING POSITION!\n", 29);
ft_free(a->exactarray, a->to_free + 1);
exit(1);
}
if (a->ft_exit < 1)
{
write(2, "\nError NO EXIT!\n", 16);
ft_free(a->exactarray, a->to_free + 1);
exit(1);
}
}
void ft_errors_2(struct s_s2 *a)
{
a->linelenght = ft_strlen(a->new[0]);
a->stringscount = a->height;
a->width = (a->linelenght - 1) * 50;
a->height = a->height * 50 ;
if (a->width == a->height)
{
write(2, "\nError The map must be rectangular!\n", 36);
ft_free(a->new, a->to_free + 1);
exit(1);
}
ft_exactmalloc(a);
}