-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexit.c
52 lines (48 loc) · 2.3 KB
/
exit.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dalba-de <dalba-de@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/03 12:26:48 by dalba-de #+# #+# */
/* Updated: 2020/05/28 12:43:48 by dalba-de ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/cub3d.h"
int bad_map(t_cub *cub)
{
if (cub->err_map)
return (exit_error(-17));
return (0);
}
int ft_close(t_cub *cub)
{
if (cub->bmp == 0)
mlx_destroy_window(cub->mlx_ptr, cub->win);
exit(0);
}
int exit_error(int err)
{
(err == -1) ? ft_putstr("Error: Invalid number of arguments\n") : 0;
(err == -2) ? ft_putstr("Error: Argument invalid\n") : 0;
(err == -3) ? ft_putstr("Error: can´t open map\n") : 0;
(err == -4) ? ft_putstr("Error: Invalid map\n") : 0;
(err == -5) ? ft_putstr("Error: Wrong resolution\n") : 0;
(err == -6) ? ft_putstr("Error: Color previosly define\n") : 0;
(err == -7) ? ft_putstr("Error: Color invalid\n") : 0;
(err == -8) ? ft_putstr("Error: Texture previosly define\n") : 0;
(err == -9) ? ft_putstr("Error: Memory allocation fail\n") : 0;
(err == -10) ? ft_putstr("Error: Invalid texture\n") : 0;
(err == -11) ? ft_putstr("Error: Error loading textures\n") : 0;
(err == -12) ? ft_putstr("Map error: (unknown element)\n") : 0;
(err == -13) ? ft_putstr("Map error: No Sprites\n") : 0;
(err == -14) ? ft_putstr("Map error: Bad Map\n") : 0;
(err == -15) ? ft_putstr("Map error: Not surrounded by walls\n") : 0;
(err == -16) ? ft_putstr("Error: no color found\n") : 0;
(err == -17) ? ft_putstr("Error: incorrect line inside map\n") : 0;
(err == -18) ? ft_putstr("Error: Resolution previosly define\n") : 0;
(err == -19) ? ft_putstr("Error: Bad configuration\n") : 0;
exit(-1);
return (-1);
}