Esempio n. 1
0
        void SetupPath(int from, int to)
        {
            WorldPath path = Find.World.pathFinder.FindPath(from, to, null);

            // path belongs to a WorldPathPool that gets very vocal in the error log
            // when theres more WorldPaths than caravans. The workaround to this error
            // is to copy the path to a new WorldPath object that is not a part of
            // the pool and Dispose of the one that is
            this.Path = new WorldPath();
            foreach (int node in path.NodesReversed)
            {
                this.Path.AddNodeAtStart(node);
            }
            this.Path.SetupFound(path.TotalCost);
            this.Path.inUse = true;
            path.Dispose();
        }