// Gets a list of paths from a source point to a number of destination points

    /* <param name="source">
     *      the origin point that paths are searched relative to </param>
     * <param name="destinations">
     *      the list of destination points we want to find paths to </param>
     * <param name="preserve_null">
     *      when a path is not found, by default it is not added as an entry to the results list
     *		when preserve_null is set to true, distances that are not found are instead added as -1 </param>
     * <param name="maxDistance">
     *		the maximum allowed distance for resulting paths. By default this value is zero, which means there is no limit to distance
     *		enabling this can significantly improve pathfinding performance </param>
     * <returns>
     * A list of paths from the source to each of the destination points </returns> */
    public List <Path> get_paths(Pos source, List <Pos> destinations, bool preserve_null = false, int maxDistance = 0)
    {
        List <List <Pos> > results = null;

        if (!IsWalkable(source))
        {
            nav_map.insertTraversableTile(source);
        }
        if (maxDistance == 0)
        {
            results = nav_map.shortestPathBatched(source, destinations);
        }
        else
        {
            results = nav_map.shortestPathBatchedInRange(source, destinations, maxDistance);
        }
        if (!IsWalkable(source))
        {
            nav_map.removeTraversableTile(source);
        }

        if (results == null)
        {
            return(null);
        }

        if (preserve_null)
        {
            List <List <Pos> > new_results = new List <List <Pos> >();
            int i = 0, j = 0;
            while (i < destinations.Count)
            {
                if (j < results.Count && destinations[i] == results[j].Last())
                {
                    new_results.Add(results[j]);
                    j++;
                }
                else
                {
                    new_results.Add(null);
                }
                i++;
            }
            results = new_results;
        }

        List <Path> paths = new List <Path>();

        foreach (List <Pos> result in results)
        {
            paths.Add(new Path(result));
        }

        return(paths);
    }