public MapCircleIterator(MapCircle circle) { this.circle = circle; radius = circle.getRadius(); currentY = -(int) (radius / MapCircle.Y_SCALE); currentLineHalfWidth = circle.getHalfLineWidth(currentY); currentX = -currentLineHalfWidth; centerX = circle.getCenterX(); centerY = circle.getCenterY(); }
/** * Occupies the given area for the given playerId if it is not already occupied by towers of an enemy. * * @param playerId * The id of the occupying player. * @param influencingArea * The area affected by the tower. * @param groundArea * The ground area of the tower. */ public void addTowerAndOccupyArea(byte playerId, MapCircle influencingArea, FreeMapArea groundArea) { IMapArea filteredArea = new MapShapeFilter(influencingArea, width, height); PartitionOccupyingTower tower = new PartitionOccupyingTower(playerId, influencingArea.getCenter(), groundArea, filteredArea, influencingArea.getBorders(), (int) influencingArea.getRadius()); occupyAreaOfTower(tower); }