-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathso_long.c
48 lines (44 loc) · 1.53 KB
/
so_long.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* so_long.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zhlim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/09 15:22:53 by zhlim #+# #+# */
/* Updated: 2023/07/24 16:26:19 by zhlim ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void initialize_map(t_map *map)
{
map->mlx = NULL;
map->mlx_win = NULL;
map->grid = NULL;
map->start_count = 0;
map->exit_count = 0;
map->collectible_count = 0;
map->rows = 0;
map->columns = 0;
map->exit_opened = 0;
map->exited = 0;
map->collected = 0;
map->walk_count = 0;
}
int main(int ac, char **av)
{
t_map map;
if (ac < 2)
print_error_exit("No map provided");
else if (ac > 2)
print_error_exit("Cannot more than one arguments");
else if (!ft_strnstr(av[1], ".ber", ft_strlen(av[1])))
print_error_exit("Not .ber file");
else
{
initialize_map(&map);
validate_map(av[1], &map);
initialize_mlx(&map);
}
return (0);
}