diff --git a/src-lib/Library/Types.hs b/src-lib/Library/Types.hs index 4801f24..c546c52 100644 --- a/src-lib/Library/Types.hs +++ b/src-lib/Library/Types.hs @@ -39,7 +39,10 @@ data ServerState = ServerState deriving (Show, Eq) -- | Type synonym for the Map. Translates to a Matrix of 'Tile's -type Map = Matrix Tile +type ServerMap = Matrix Tile + +-- | Type synonym for the Map. Translates to a Matrix of 'Maybe Tile's +type ClientMap = Matrix (Maybe Tile) data Tile = Air -- ^ walkable area @@ -53,7 +56,7 @@ data ServerOptions = ServerOptions deriving (Show, Eq) data Arena = Arena - { arenaMap :: Map + { arenaMap :: ServerMap , arenaSpawners :: [Spawner] } deriving (Show, Eq) diff --git a/src-server/Server/Map.hs b/src-server/Server/Map.hs index 6929b75..3287e49 100644 --- a/src-server/Server/Map.hs +++ b/src-server/Server/Map.hs @@ -43,12 +43,12 @@ generateArena arenaRows arenaColumns spawnerChance = do generateMap :: Int -- ^ Map's height -> Int -- ^ Map's width - -> IO Map -- ^ resulting Map + -> IO ServerMap -- ^ resulting Map generateMap mapRows mapColumns = do let initMap = M.matrix mapRows mapColumns (const Air) divide 0 0 mapRows mapColumns initMap where - divide :: Int -> Int -> Int -> Int -> Map -> IO Map + divide :: Int -> Int -> Int -> Int -> ServerMap -> IO ServerMap divide rowOffset colOffset rowSize colSize tilemap | rowSize <= 3 || colSize <= 3 = pure tilemap | otherwise = do diff --git a/wizard-wipeout.cabal b/wizard-wipeout.cabal index 17ed34c..c761989 100644 --- a/wizard-wipeout.cabal +++ b/wizard-wipeout.cabal @@ -33,6 +33,7 @@ executable wizard-wipeout-client -- other-modules: -- other-extensions: build-depends: base ^>=4.17.2.1 + , network , wizard-wipeout hs-source-dirs: src-client default-language: GHC2021 @@ -46,6 +47,7 @@ executable wizard-wipeout-server build-depends: base ^>=4.17.2.1 , linear , matrix + , network , random , wizard-wipeout hs-source-dirs: src-server