LambdaHack-0.8.3.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Common.State

Contents

Description

The common server and client basic game state type and its operations.

Synopsis

Basic game state, local or global

data State #

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).

Instances
Eq State # 
Instance details

Defined in Game.LambdaHack.Common.State

Methods

(==) :: State -> State -> Bool #

(/=) :: State -> State -> Bool #

Show State # 
Instance details

Defined in Game.LambdaHack.Common.State

Methods

showsPrec :: Int -> State -> ShowS #

show :: State -> String #

showList :: [State] -> ShowS #

Binary State # 
Instance details

Defined in Game.LambdaHack.Common.State

Methods

put :: State -> Put #

get :: Get State #

putList :: [State] -> Put #

State components

State construction

defStateGlobal :: Dungeon -> AbsDepth -> FactionDict -> COps -> ScoreDict -> ContentId ModeKind -> DiscoveryKind -> State #

Initial complete global game state.

emptyState :: State #

Initial empty state.

localFromGlobal :: State -> State #

Local state created by removing secret information from global state components.

State update

updateDungeon :: (Dungeon -> Dungeon) -> State -> State #

Update dungeon data within state.

updateDepth :: (AbsDepth -> AbsDepth) -> State -> State #

Update dungeon depth.

updateActorD :: (ActorDict -> ActorDict) -> State -> State #

Update the actor dictionary.

updateItemD :: (ItemDict -> ItemDict) -> State -> State #

Update the item dictionary.

updateItemIxMap :: (ItemIxMap -> ItemIxMap) -> State -> State #

Update the item kind index map.

updateFactionD :: (FactionDict -> FactionDict) -> State -> State #

Update faction data within state.

updateTime :: (Time -> Time) -> State -> State #

Update global time within state.

updateCOpsAndCachedData :: (COps -> COps) -> State -> State #

Update content data within state and recompute the cached data.

updateGold :: (Int -> Int) -> State -> State #

Update total gold value in the dungeon.

State operations

Internal operations

unknownLevel :: COps -> ContentId CaveKind -> AbsDepth -> X -> Y -> ([Point], [Point]) -> [Point] -> Int -> Bool -> Level #