Safe Haskell | None |
---|---|
Language | Haskell2010 |
Operations on the Area
type that involve random numbers.
- xyInArea :: Area -> Rnd Point
- mkVoidRoom :: Area -> Rnd Area
- mkRoom :: (X, Y) -> (X, Y) -> Area -> Rnd Area
- mkFixed :: (X, Y) -> Area -> Point -> Area
- connectGrid :: EnumSet Point -> (X, Y) -> Rnd [(Point, Point)]
- randomConnection :: (X, Y) -> Rnd (Point, Point)
- data HV
- type Corridor = [Point]
- connectPlaces :: (Area, Fence, Area) -> (Area, Fence, Area) -> Rnd (Maybe Corridor)
Picking points inside areas
mkVoidRoom :: Area -> Rnd Area Source #
Create a void room, i.e., a single point area within the designated area.
:: (X, Y) | minimum size |
-> (X, Y) | maximum size |
-> Area | the containing area, not the room itself |
-> Rnd Area |
Create a random room according to given parameters.
Choosing connections
connectGrid :: EnumSet Point -> (X, Y) -> Rnd [(Point, Point)] Source #
Pick a subset of connections between adjacent areas within a grid until there is only one connected component in the graph of all areas.
randomConnection :: (X, Y) -> Rnd (Point, Point) Source #
Pick a single random connection between adjacent areas within a grid.
Plotting corridors
connectPlaces :: (Area, Fence, Area) -> (Area, Fence, Area) -> Rnd (Maybe Corridor) Source #
Try to connect two interiors of places with a corridor.
Choose entrances some steps away from the edges, if the place
is big enough. Note that with pfence == FNone
, the inner area considered
is the strict interior of the place, without the outermost tiles.
The corridor connects (touches) the inner areas and the turning point of the corridor (if any) is outside of the outer areas and inside the grid areas.