Safe Haskell | None |
---|---|
Language | Haskell2010 |
The common server and client basic game state type and its operations.
Synopsis
- data State
- sdungeon :: State -> Dungeon
- stotalDepth :: State -> AbsDepth
- sactorD :: State -> ActorDict
- sitemD :: State -> ItemDict
- sitemIxMap :: State -> ItemIxMap
- sfactionD :: State -> FactionDict
- stime :: State -> Time
- scops :: State -> COps
- sgold :: State -> Int
- shigh :: State -> ScoreDict
- sgameModeId :: State -> ContentId ModeKind
- sdiscoKind :: State -> DiscoveryKind
- sdiscoAspect :: State -> DiscoveryAspect
- sactorAspect :: State -> ActorAspect
- defStateGlobal :: Dungeon -> AbsDepth -> FactionDict -> COps -> ScoreDict -> ContentId ModeKind -> DiscoveryKind -> State
- emptyState :: State
- localFromGlobal :: State -> State
- updateDungeon :: (Dungeon -> Dungeon) -> State -> State
- updateDepth :: (AbsDepth -> AbsDepth) -> State -> State
- updateActorD :: (ActorDict -> ActorDict) -> State -> State
- updateItemD :: (ItemDict -> ItemDict) -> State -> State
- updateItemIxMap :: (ItemIxMap -> ItemIxMap) -> State -> State
- updateFactionD :: (FactionDict -> FactionDict) -> State -> State
- updateTime :: (Time -> Time) -> State -> State
- updateCOpsAndCachedData :: (COps -> COps) -> State -> State
- updateGold :: (Int -> Int) -> State -> State
- updateDiscoKind :: (DiscoveryKind -> DiscoveryKind) -> State -> State
- updateDiscoAspect :: (DiscoveryAspect -> DiscoveryAspect) -> State -> State
- updateActorAspect :: (ActorAspect -> ActorAspect) -> State -> State
- getItemBody :: ItemId -> State -> Item
- aspectRecordFromItem :: ItemId -> Item -> State -> AspectRecord
- aspectRecordFromIid :: ItemId -> State -> AspectRecord
- aspectRecordFromActor :: Actor -> State -> AspectRecord
- actorAspectInDungeon :: State -> ActorAspect
- unknownLevel :: COps -> ContentId CaveKind -> AbsDepth -> X -> Y -> ([Point], [Point]) -> [Point] -> Int -> Bool -> Level
- unknownTileMap :: ContentId TileKind -> Int -> Int -> TileMap
Basic game state, local or global
View on the basic game state.
The remembered
fields, in client copies of the state, carry only
a subset of the full information that the server keeps.
Clients never directly change their State
, but apply
atomic actions sent by the server to do so (and/or the server applies
the actions to each client state in turn).
State components
stotalDepth :: State -> AbsDepth Source #
sitemIxMap :: State -> ItemIxMap Source #
sfactionD :: State -> FactionDict Source #
sdiscoKind :: State -> DiscoveryKind Source #
sdiscoAspect :: State -> DiscoveryAspect Source #
sactorAspect :: State -> ActorAspect Source #
State construction
defStateGlobal :: Dungeon -> AbsDepth -> FactionDict -> COps -> ScoreDict -> ContentId ModeKind -> DiscoveryKind -> State Source #
Initial complete global game state.
emptyState :: State Source #
Initial empty state.
localFromGlobal :: State -> State Source #
Local state created by removing secret information from global state components.
State update
updateItemIxMap :: (ItemIxMap -> ItemIxMap) -> State -> State Source #
Update the item kind index map.
updateFactionD :: (FactionDict -> FactionDict) -> State -> State Source #
Update faction data within state.
updateCOpsAndCachedData :: (COps -> COps) -> State -> State Source #
Update content data within state and recompute the cached data.
updateDiscoKind :: (DiscoveryKind -> DiscoveryKind) -> State -> State Source #
updateDiscoAspect :: (DiscoveryAspect -> DiscoveryAspect) -> State -> State Source #
updateActorAspect :: (ActorAspect -> ActorAspect) -> State -> State Source #
State operations
aspectRecordFromItem :: ItemId -> Item -> State -> AspectRecord Source #
aspectRecordFromIid :: ItemId -> State -> AspectRecord Source #
aspectRecordFromActor :: Actor -> State -> AspectRecord Source #