License | BSD-3-Clause |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
Swarm.Game.Scenario.Topography.WorldPalette
Description
Synopsis
- type WorldPalette e = StructurePalette (PCell e)
- type TerrainWith a = (TerrainType, Erasable a)
- cellToTerrainPair :: CellPaintDisplay -> TerrainWith EntityFacade
- toCellPaintDisplay :: Cell -> CellPaintDisplay
- toKey :: TerrainWith EntityFacade -> TerrainWith EntityName
- getUniqueTerrainFacadePairs :: [CellPaintDisplay] -> Map (TerrainWith EntityName) (TerrainWith EntityFacade)
- constructPalette :: [(Char, TerrainWith EntityFacade)] -> KeyMap CellPaintDisplay
- constructWorldMap :: [(Char, TerrainWith EntityFacade)] -> Char -> Grid (Maybe CellPaintDisplay) -> String
- genericCharacterPool :: Set Char
- data PaletteAndMaskChar = PaletteAndMaskChar {}
- prepForJson :: PaletteAndMaskChar -> Grid (Maybe CellPaintDisplay) -> (String, KeyMap CellPaintDisplay)
Documentation
type WorldPalette e = StructurePalette (PCell e) Source #
A world palette maps characters to Cell
values.
type TerrainWith a = (TerrainType, Erasable a) Source #
getUniqueTerrainFacadePairs :: [CellPaintDisplay] -> Map (TerrainWith EntityName) (TerrainWith EntityFacade) Source #
We want to identify all of the unique (terrain, entity facade) pairs. However, EntityFacade includes a Display record, which contains more fields than desirable for use as a unique key. Therefore, we extract just the entity name for use in a (terrain, entity name) key, and couple it with the original (terrain, entity facade) pair in a Map.
constructPalette :: [(Char, TerrainWith EntityFacade)] -> KeyMap CellPaintDisplay Source #
Arguments
:: [(Char, TerrainWith EntityFacade)] | |
-> Char | Mask char |
-> Grid (Maybe CellPaintDisplay) | |
-> String |
genericCharacterPool :: Set Char Source #
All alphanumeric characters. These are used as supplemental map placeholders in case a pre-existing display character is not available to re-use.
data PaletteAndMaskChar Source #
Constructors
PaletteAndMaskChar | |
Fields
|
prepForJson :: PaletteAndMaskChar -> Grid (Maybe CellPaintDisplay) -> (String, KeyMap CellPaintDisplay) Source #
Note that display characters are not unique across different entities! However, the palette KeyMap as a conveyance serves to dedupe them.