/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* map.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cchauvet patern = ft_readfile(path); if (ft_map_is_correct(map) == 0) return (NULL); return (map); } char **ft_get_player_map(t_map map) { char **player_map; ssize_t y; ssize_t i; player_map = malloc(RENDER_DISTANCE * 2 + 2); if (player_map == NULL) return (NULL); y = -RENDER_DISTANCE; while (y < map.y_len - map.player_pos[1] - RENDER_DISTANCE) { i = map.player_pos[1] + y; player_map[y] = ft_strndup(map.patern[i], RENDER_DISTANCE * 2 + 1); if (player_map[y] == NULL) { ft_cancel(player_map, RENDER_DISTANCE - y); return (NULL); } y++; } player_map[y] = NULL; return (player_map); }