Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generation of places from place kinds.
Synopsis
- data Place = Place {}
- type TileMapEM = EnumMap Point (ContentId TileKind)
- buildPlace :: COps -> CaveKind -> Bool -> ContentId TileKind -> ContentId TileKind -> AbsDepth -> AbsDepth -> Word32 -> Area -> Maybe Area -> Freqs PlaceKind -> Rnd Place
- isChancePos :: Int -> Int -> Word32 -> Point -> Bool
- buildFenceRnd :: COps -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> Area -> Rnd TileMapEM
- placeCheck :: Area -> PlaceKind -> Bool
- interiorArea :: PlaceKind -> Area -> Maybe Area
- olegend :: COps -> GroupName TileKind -> Rnd (EnumMap Char (Int, Int, ContentId TileKind), EnumMap Char (ContentId TileKind))
- pover :: COps -> [(Char, GroupName TileKind)] -> Rnd (EnumMap Char (Int, Int, ContentId TileKind), EnumMap Char (ContentId TileKind))
- buildFence :: COps -> CaveKind -> Bool -> ContentId TileKind -> ContentId TileKind -> Bool -> Fence -> Area -> Rnd TileMapEM
- buildFenceMap :: ContentId TileKind -> 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
.
:: 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 |
-> Word32 | secret tile seed |
-> Area | whole area of the place, fence included |
-> Maybe Area | whole inner area of the grid cell |
-> Freqs PlaceKind | optional fixed place freq |
-> Rnd Place |
Given a few parameters, roll and construct a Place
datastructure
and fill a cave section acccording to it.
buildFenceRnd :: COps -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> Area -> Rnd TileMapEM Source #
Construct a fence around an area, with the given tile group.
Internal operations
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.
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, Int, ContentId TileKind), EnumMap Char (ContentId TileKind)) Source #
Roll a legend of a place plan: a map from plan symbols to tile kinds.
pover :: COps -> [(Char, GroupName TileKind)] -> Rnd (EnumMap Char (Int, Int, ContentId TileKind), EnumMap Char (ContentId TileKind)) Source #
buildFence :: COps -> CaveKind -> Bool -> ContentId TileKind -> ContentId TileKind -> Bool -> Fence -> Area -> Rnd TileMapEM Source #
Construct a fence around a place.