Package squidpony.squidgrid.mapping
Class RectangleRoomFinder
java.lang.Object
squidpony.squidgrid.mapping.RectangleRoomFinder
public class RectangleRoomFinder extends Object
An algorithm to find rectangle areas in dungeons. It is a simpler and faster
alternative to
RoomFinder. You can execute
RectangleRoomsFinderTest to see how it performs.- Author:
- smelC
- See Also:
A fancier room finder
-
Field Summary
Fields Modifier and Type Field Description protected char[][]dungeonprotected intdungeonHeightprotected intdungeonWidthprotected Set<Character>floorsintminimumDiagonalThe minimum number of cells that the diagonal of a room must have.booleanonlySquareRoomstrueto restrictthisto find square rooms -
Constructor Summary
Constructors Constructor Description RectangleRoomFinder(char[][] dungeon) -
Method Summary
Modifier and Type Method Description booleanaddFloorCharacter(char c)Adds a character considered as a floor.protected RectangleextendRoom(boolean[][] assigneds, Rectangle r, Direction d)protected RectangleextendRoomOnce(boolean[][] assigneds, Rectangle r, Direction d)List<Rectangle>findRectangles()protected booleanisFloor(char c)protected booleanisInDungeon(Coord c)booleanremoveFloorCharacter(char c)Removes a character from being considered as a floor.
-
Field Details
-
dungeon
-
dungeonWidth
-
dungeonHeight
-
floors
-
minimumDiagonal
The minimum number of cells that the diagonal of a room must have. Having 3 here means that, by default, only rooms at most 3x3 are considered. -
onlySquareRooms
trueto restrictthisto find square rooms
-
-
Constructor Details
-
Method Details
-
addFloorCharacter
Adds a character considered as a floor.- Parameters:
c-- Returns:
trueifcwasn't a floor character.
-
removeFloorCharacter
Removes a character from being considered as a floor.- Parameters:
c-- Returns:
trueifcwas a floor character.
-
findRectangles
- Returns:
- The rectangles of the dungeon given at creation time.
-
extendRoom
- Parameters:
assigneds- Cells already in a room.d- A cardinal direction.- Returns:
- A variant of
rextended to the directiond, if possible.ritself if unaffected.
-
extendRoomOnce
- Parameters:
assigneds- Cells already in a room. This array is muted by this call.
-
isFloor
-
isInDungeon
-