-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore_map.c
56 lines (52 loc) · 1.66 KB
/
store_map.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* store_map.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bmerchin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/23 11:36:15 by bmerchin #+# #+# */
/* Updated: 2021/02/23 11:36:17 by bmerchin ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void store_map2(int fd, t_data *data, int retour)
{
while ((retour = get_next_line(fd, &data->map[data->y_map])) == 1 ||
data->map[data->y_map][0] != '\0')
{
if (!BONUS)
ft_putstr_bn(data->map[data->y_map]);
data->y_map = data->y_map + 1;
if (data->y_map == 1024)
{
ft_putstr_bn("Error\nYour Map Is Too Long");
break ;
}
}
}
void store_map(int fd, t_data *data)
{
int retour;
int i;
data->y_map = 0;
while ((retour = get_next_line(fd, &data->map[0])) == 1)
{
if (!BONUS)
ft_putstr_bn(data->map[0]);
i = 0;
while (i < ft_strlen(data->map[0]))
{
if (is_in(data->map[0][i], data->wl))
{
data->y_map = 1;
break ;
}
i++;
}
if (is_in(data->map[0][i], data->wl))
break ;
free(data->map[0]);
}
store_map2(fd, data, retour);
}