public RegionPathCostHeuristic(Map map, IntVec3 start, CellRect end, IEnumerable <Region> destRegions, TraverseParms parms, NewPathFinder.PawnPathCostSettings pathCosts)
        {
            this.map       = map;
            startCell      = start;
            targetCell     = end.CenterCell;
            targetRect     = end;
            this.pathCosts = pathCosts;

            rootRegions   = new HashSet <Region>(destRegions);
            traverseParms = parms;
        }
        public RegionLinkDijkstra(Map map, CellRect destination, IEnumerable <Region> startingRegions, IntVec3 target, TraverseParms parms, NewPathFinder.PawnPathCostSettings pathCosts)
        {
            this.map              = map;
            this.regionGrid       = RegionPathCostHeuristic.regionGridGet(map.regionGrid);
            this.traverseParms    = parms;
            this.targetCell       = target;
            this.rootCell         = destination.CenterCell;
            this.pathCostSettings = pathCosts;
            avoidGrid             = pathCosts.avoidGrid;
            area         = pathCosts.area;
            nodes_popped = 0;

            //if (DebugViewSettings.drawPaths && !NewPathFinder.disableDebugFlash)
            //{
            //	debugPathfinder = new NewPathFinder(map);
            //}

            //Init the starting region links from the start cell
            foreach (var region in startingRegions)
            {
                var minPathCost = RegionMedianPathCost(region);
                foreach (RegionLink current in region.links)
                {
                    var dist = RegionLinkDistance(rootCell, current, minPathCost);
                    if (distances.ContainsKey(current))
                    {
                        if (dist < distances[current])
                        {
                            linkTargetCells[current] = GetLinkTargetCell(rootCell, current);
                        }
                        dist = Math.Min(distances[current], dist);
                    }
                    else
                    {
                        linkTargetCells[current] = GetLinkTargetCell(rootCell, current);
                    }
                    distances[current] = dist;
                }
                foreach (var pair in PreciseRegionLinkDistances(region, destination))
                {
                    var current = pair.First;
                    var dist    = Math.Max(pair.Second, distances[current]);
                    distances[current] = dist;
                    queue.Push(new RegionLinkQueueEntry(region, current, dist, dist));
                }
            }
        }