add: replace player spawn char to '0' and store spawn_direction

This commit is contained in:
Camille Chauvet 2023-05-04 11:58:30 +00:00
parent b323b98dc0
commit c9d9faa45c
2 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,7 @@ typedef struct s_map
long long color_top; long long color_top;
long long spawn_x; long long spawn_x;
long long spawn_y; long long spawn_y;
char direction;
} t_map; } t_map;
#endif #endif

View File

@ -20,6 +20,7 @@ static ssize_t get_nb_line(const char *path)
close(fd); close(fd);
return (i); return (i);
} }
static char **read_map(const char *path) static char **read_map(const char *path)
{ {
int fd; int fd;
@ -82,5 +83,7 @@ t_map *map_parsing(const char *path)
return (NULL); return (NULL);
} }
map->map = body; map->map = body;
map->direction = map->map[map->spawn_y][map->spawn_x];
map->map[map->spawn_y][map->spawn_x] = '0';
return (map); return (map);
} }