Esempio n. 1
0
        public bool checkRegionSize()
        {
            int count    = 0;
            int maxCount = 0;
            int dir      = 0;
            int tmp;

            // if region has less than 4 tiles it is considered "bad size"
            if (tiles.Count < 4)
            {
                return(false);
            }

            foreach (MECoord tile in tiles)
            {
                count = 0;
                for (dir = 0; dir < 6; dir++)
                {
                    tmp = map.getNeighborTile(tile.x, tile.y, dir);
                    if (tmp == Id)
                    {
                        count++;
                    }
                }
                // found tile bordering with at least 4 tile of the same region
                if (count > maxCount)
                {
                    maxCount = count;
                }
                if (maxCount >= 4)
                {
                    return(true);
                }
            }

            return(false);
        }