Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generation of places from place kinds.
Synopsis
- data Place = Place {}
- type TileMapEM = EnumMap Point (ContentId TileKind)
- placeCheck :: Area -> PlaceKind -> Bool
- buildPlace :: COps -> CaveKind -> Bool -> ContentId TileKind -> ContentId TileKind -> AbsDepth -> AbsDepth -> Int -> Area -> Maybe (GroupName PlaceKind) -> Rnd (TileMapEM, Place)
- isChancePos :: Int -> Int -> Point -> Bool
- buildFenceRnd :: COps -> GroupName TileKind -> Area -> Rnd TileMapEM
- interiorArea :: PlaceKind -> Area -> Maybe Area
- olegend :: COps -> GroupName TileKind -> Rnd (EnumMap Char (Int, ContentId TileKind), EnumMap Char (ContentId TileKind))
- ooverride :: COps -> [(Char, GroupName TileKind)] -> Rnd (EnumMap Char (Int, ContentId TileKind), EnumMap Char (ContentId TileKind))
- buildFence :: ContentId TileKind -> Area -> TileMapEM
- tilePlace :: Area -> PlaceKind -> Rnd (EnumMap Point Char)
Documentation
The parameters of a place. All are immutable and rolled and fixed at the time when a place is generated.
type TileMapEM = EnumMap Point (ContentId TileKind) Source #
The map of tile kinds in a place (and generally anywhere in a cave).
The map is sparse. The default tile that eventually fills the empty spaces
is specified in the cave kind specification with cdefTile
.
For CAlternate
tiling, require the place be comprised
of an even number of whole corners, with exactly one square
overlap between consecutive coners and no trimming.
For other tiling methods, check that the area is large enough for tiling
the corner twice in each direction, with a possible one row/column overlap.
:: COps | the game content |
-> CaveKind | current cave kind |
-> Bool | whether the cave is dark |
-> ContentId TileKind | dark fence tile, if fence hollow |
-> ContentId TileKind | lit fence tile, if fence hollow |
-> AbsDepth | current level depth |
-> AbsDepth | absolute depth |
-> Int | secret tile seed |
-> Area | whole area of the place, fence included |
-> Maybe (GroupName PlaceKind) | optional fixed place group |
-> Rnd (TileMapEM, Place) |
Given a few parameters, roll and construct a Place
datastructure
and fill a cave section acccording to it.
buildFenceRnd :: COps -> GroupName TileKind -> Area -> Rnd TileMapEM Source #
Construct a fence around an area, with the given tile group.
Internal operations
interiorArea :: PlaceKind -> Area -> Maybe Area Source #
Calculate interior room area according to fence type, based on the total area for the room and it's fence. This is used for checking if the room fits in the area, for digging up the place and the fence and for deciding if the room is dark or lit later in the dungeon generation process.
olegend :: COps -> GroupName TileKind -> Rnd (EnumMap Char (Int, ContentId TileKind), EnumMap Char (ContentId TileKind)) Source #
Roll a legend of a place plan: a map from plan symbols to tile kinds.
ooverride :: COps -> [(Char, GroupName TileKind)] -> Rnd (EnumMap Char (Int, ContentId TileKind), EnumMap Char (ContentId TileKind)) Source #