Example #1
0
        public static List <int> GetAllCellsForThisLinePath(int dir, int baseCell, int remoteCell, Map map)
        {
            List <int> cells = new List <int>();

            if (!Pathfinder.InLine(map, baseCell, remoteCell))
            {
                return(cells);
            }
            bool pathFinished = false;
            int  timeOut      = 0;

            while (!pathFinished)
            {
                baseCell = Pathfinder.DirToCellID(baseCell, char.Parse(GetDirChar(dir)), map, false);
                if (baseCell == remoteCell)
                {
                    pathFinished = true;
                }
                else
                {
                    cells.Add(baseCell);
                }
                timeOut++;
                if (timeOut >= 30)
                {
                    break;
                }
            }
            return(cells);
        }