Add FromClient messages to handle game sync at reconnection and move logs into PublicGame data structure for simplicity

This commit is contained in:
Tissevert 2020-01-20 22:57:13 +01:00
parent 4c404df4d6
commit 59c467e988
1 changed files with 5 additions and 1 deletions

View File

@ -80,6 +80,9 @@ data FromClient =
| Answer {accept :: Bool, to :: PlayerID}
| Invitation {to :: PlayerID}
| Play {move :: KoiKoi.Move, onGame :: PublicGame}
| Share {gameSave :: PublicGame}
| Sync {latestKnown :: Coordinates, to :: PlayerID}
| Yield {onGameID :: GameID, to :: PlayerID}
| Quit
| Ping
deriving (Generic, Show)
@ -196,6 +199,7 @@ instance ToJSON ByteString where
data PublicGame = PublicGame {
nonce :: ByteString
, logs :: [KoiKoi.Action]
, playerHand :: Hanafuda.Pack
, private :: ByteString
, public :: PublicState
@ -212,7 +216,7 @@ data T =
| Okaeri {room :: Room}
| LogIn {from :: PlayerID, as :: Text}
| LogOut {from :: PlayerID}
| Game {state :: PublicGame, logs :: [KoiKoi.Action]}
| Game {state :: PublicGame}
| Pong
| Error {error :: String}
deriving (Generic)