fix: leak && 1x1 map not surround
This commit is contained in:
parent
fbb9864ef4
commit
5bdc48340d
@ -95,7 +95,5 @@ int map_parsing(const char *path, t_map *map)
|
||||
ft_freer_tab_ultimate(1, file_content);
|
||||
if (body_is_valid(map) == 0)
|
||||
return (1);
|
||||
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 (0);
|
||||
}
|
||||
|
@ -157,12 +157,8 @@ int body_is_valid(t_map *map)
|
||||
ft_eprintf("map: spawn position: not define");
|
||||
return (0);
|
||||
}
|
||||
error = map_surround((const char **)map->map);
|
||||
if (error)
|
||||
{
|
||||
ft_eprintf("map: not surrounded");
|
||||
return (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';
|
||||
error = map_is_in_one_part((const char **)map->map);
|
||||
if (error)
|
||||
{
|
||||
@ -171,6 +167,12 @@ int body_is_valid(t_map *map)
|
||||
}
|
||||
if (body_contain_normal_char((const char **)map->map) == 0)
|
||||
return (0);
|
||||
error = map_surround((const char **)map->map);
|
||||
if (error)
|
||||
{
|
||||
ft_eprintf("map: not surrounded");
|
||||
return (0);
|
||||
}
|
||||
get_size((const char **)map->map, map);
|
||||
return (1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user