fix: use same t_map in all code
This commit is contained in:
@ -10,8 +10,8 @@ typedef struct s_map
|
||||
void *img[4];
|
||||
long long color_bot;
|
||||
long long color_top;
|
||||
long long spawn_x;
|
||||
long long spawn_y;
|
||||
double ply_x;
|
||||
double ply_y;
|
||||
char direction;
|
||||
} t_map;
|
||||
|
||||
|
@ -83,7 +83,7 @@ t_map *map_parsing(const char *path)
|
||||
return (NULL);
|
||||
}
|
||||
map->map = body;
|
||||
map->direction = map->map[map->spawn_y][map->spawn_x];
|
||||
map->map[map->spawn_y][map->spawn_x] = '0';
|
||||
map->direction = map->map[(size_t) map->ply_y][(size_t) map->ply_x];
|
||||
map->map[(size_t) map->ply_y][(size_t) map->ply_x] = '0';
|
||||
return (map);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ char **get_body(const char **file_content, size_t header_size)
|
||||
return (body);
|
||||
}
|
||||
|
||||
int get_spawn_position(const char **body, long long *spawn_x, long long *spawn_y)
|
||||
int get_spawn_position(const char **body, double *spawn_x, double *spawn_y)
|
||||
{
|
||||
size_t x;
|
||||
size_t y;
|
||||
@ -160,7 +160,7 @@ int body_is_valid(const char **body, t_map *map)
|
||||
|
||||
if (body == NULL)
|
||||
return (0);
|
||||
error = get_spawn_position(body, &map->spawn_x, &map->spawn_y);
|
||||
error = get_spawn_position(body, &map->ply_x, &map->ply_y);
|
||||
if (error == 1)
|
||||
{
|
||||
ft_eprintf("map: spawn position: multiple definition");
|
||||
|
Reference in New Issue
Block a user