add: replace player spawn char to '0' and store spawn_direction
This commit is contained in:
		| @ -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 | ||||||
|  | |||||||
| @ -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); | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user