Пример #1
0
 public void SetMapSideMark(int line, int col, General.Legend mark)
 {
     if (line > 0 && col > 0 &&
         line < General.TilesVertically &&
         col < General.TilesHorizontaly &&
         Map[line][col] != (int)General.Legend.PlayerPath &&
         Map[line][col] != (int)General.Legend.DragonPath)
     {
         Map[line][col] = (int)mark;
     }
 }
Пример #2
0
        public int FillMapForMark(int line, int col, General.Legend mark)
        {
            if (Map[line][col] == (int)General.Legend.PlayerPath || Map[line][col] == (int)General.Legend.DragonPath)
            {
                return(0);
            }
            Map[line][col] = 100 * (int)mark;  // mark map with mark int value

            return(1 + FillMapForMark(line - 1, col, mark)
                   + FillMapForMark(line, col + 1, mark)
                   + FillMapForMark(line + 1, col, mark)
                   + FillMapForMark(line, col - 1, mark));
        }
Пример #3
0
        private Point GetFirstMarkPoint(int[][] map, General.Legend mark)
        {
            for (int line = 0; line < General.TilesVertically; line++)
            {
                for (int col = 0; col < General.TilesHorizontaly; col++)
                {
                    if (Map[line][col] == (int)mark)
                    {
                        return(new Point(col, line));
                    }
                }
            }

            return(Point.Zero);
        }
Пример #4
0
        private int FillMapForMark(General.Legend mark, Point toMark, int marks)
        {
            Map[toMark.Y][toMark.X] = (int)mark * 100;  // transform in area mark
            for (int line = -1; line < 1; line++)
            {
                for (int col = -1; col < toMark.Y; col++)
                {
                    if (Math.Abs(col + line) == 1)
                    {
                        if (!OutOfScreen(new Point(toMark.Y + line, toMark.X + col)))
                        {
                            if (Map[toMark.Y + line][toMark.X + col] == (int)mark)
                            {
                                return(marks + FillMapForMark(mark, new Point(toMark.X + col, toMark.Y + line), marks));
                            }
                        }
                    }
                }
            }

            return(marks);
        }