-
Notifications
You must be signed in to change notification settings - Fork 0
/
checker.c
72 lines (67 loc) · 2.15 KB
/
checker.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
70
71
72
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: htorp <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/01 16:57:04 by htorp #+# #+# */
/* Updated: 2019/05/01 16:57:08 by htorp ### ########.fr */
/* */
/* ************************************************************************** */
#include "wolf3d.h"
int arg1(int *i, char **argv)
{
while (*i < 3)
{
if (argv[2][*i] == 0)
{
write(1, "Error: Unvalid size of map legend!!!\n", 37);
write(1, "Usage: ./wolf3d [map] ", 22);
write(1, "[map legend: wall/space/person]\n", 31);
return (0);
}
if ((argv[2][*i] < ' ') || (argv[2][*i] > '~'))
{
write(1, "Error: Unvalid map legend!!!\n", 29);
write(1, "Usage: ./wolf3d [map] ", 22);
write(1, "[map legend: wall/space/person]\n", 31);
return (0);
}
*i = *i + 1;
}
return (1);
}
int arg_check(int argc, char **argv)
{
int i;
if (argc != 3)
write(1, "Usage: ./wolf3d [map] [map legend: wall/space/person]\n", 54);
if (argc != 3)
return (0);
i = 0;
if (!arg1(&i, argv))
return (0);
if (argv[2][i] != 0)
{
write(1, "Error: Unvalid size of map legend!!!\n", 37);
write(1, "Usage: ./wolf3d [map] [map legend: wall/space/person]\n", 54);
return (0);
}
if ((argv[2][0] == argv[2][1]) ||
(argv[2][0] == argv[2][2]) || (argv[2][1] == argv[2][2]))
{
write(1, "Error: Unvalid map legend!!!\n", 29);
write(1, "Usage: ./wolf3d [map] [map legend: wall/space/person]\n", 54);
return (0);
}
return (1);
}
void texture_check(int x, int y)
{
if (x != BLOCK || y != BLOCK)
{
write(1, "Invalid Textures\n", 17);
exit(EXIT_SUCCESS);
}
}