예제 #1
0
        /**
         * Does this tile area contain a tile?
         * @param tile Tile to test for.
         * @return True if the tile is inside the area.
         */
        public bool Contains(TileIndex tile)
        {
            if (w == 0)
            {
                return(false);
            }
            if (w == 0 || h == 0)
            {
                throw new InvalidOperationException("This has no width or height");
            }

            uint left   = Map.TileX(this.tile);
            uint top    = Map.TileY(this.tile);
            uint tile_x = Map.TileX(tile);
            uint tile_y = Map.TileY(tile);

            return(MathFuncs.IsInsideBS((int)tile_x, left, w) && MathFuncs.IsInsideBS((int)tile_y, top, h));
        }