2023-12-10 11:44:23 +00:00
|
|
|
module Client.Types where
|
|
|
|
|
2023-12-12 10:21:25 +00:00
|
|
|
import qualified Control.Concurrent.STM as STM
|
|
|
|
|
2023-12-10 14:18:40 +00:00
|
|
|
import Control.Monad.RWS
|
|
|
|
|
|
|
|
import Data.UUID
|
|
|
|
|
2023-12-10 19:12:53 +00:00
|
|
|
import Network.Socket
|
2023-12-10 11:44:23 +00:00
|
|
|
|
2023-12-10 19:12:53 +00:00
|
|
|
import Options.Applicative as O
|
2023-12-10 14:18:40 +00:00
|
|
|
|
|
|
|
-- internal imports
|
|
|
|
|
|
|
|
import Library.Types
|
|
|
|
|
2023-12-10 11:44:23 +00:00
|
|
|
newtype Options = Options
|
|
|
|
{ optSockLoc :: FilePath
|
|
|
|
}
|
|
|
|
|
|
|
|
options :: O.Parser Options
|
|
|
|
options = Options
|
|
|
|
<$> argument str
|
|
|
|
( metavar "FILEPATH"
|
|
|
|
<> help "Location of the server's socket"
|
|
|
|
)
|
2023-12-10 14:18:40 +00:00
|
|
|
|
|
|
|
data ReaderContainer = ReaderContainer
|
2023-12-12 08:47:50 +00:00
|
|
|
{ rcSocket :: Socket
|
|
|
|
, rcClientUUID :: UUID
|
2023-12-20 07:12:22 +00:00
|
|
|
, rcQueue :: STM.TQueue ServerMessage
|
2023-12-10 14:18:40 +00:00
|
|
|
}
|
|
|
|
|
2023-12-12 10:21:25 +00:00
|
|
|
data StateContainer = StateContainer
|
2023-12-12 08:47:50 +00:00
|
|
|
{ scWizard :: Wizard
|
2023-12-12 10:21:25 +00:00
|
|
|
, scClientState :: STM.TMVar ClientState
|
2023-12-20 07:12:22 +00:00
|
|
|
, scMapSlice :: MapSlice
|
2023-12-10 14:18:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Game = RWST ReaderContainer String StateContainer IO
|