gameServer/ServerState.hs
author koda
Thu, 03 Jun 2010 18:31:56 +0000
changeset 3492 07256e1ad559
parent 3458 11cd56019f00
child 3501 a3159a410e5c
permissions -rw-r--r--
map preview generation reworked like nemo suggested (he was right, it's quickier in this way) add some rounding image capabilities for more professional look

module ServerState
    (
    module RoomsAndClients,
    clientRoomA,
    ServerState(..),
    clients
    ) where

import Control.Monad.State
----------------------
import RoomsAndClients
import CoreTypes

data ServerState = ServerState {
        clientIndex :: Maybe ClientIndex,
        serverInfo :: ServerInfo,
        roomsClients :: MRnC
    }


clientRoomA :: StateT ServerState IO RoomIndex
clientRoomA = do
    (Just ci) <- gets clientIndex
    rnc <- gets roomsClients
    liftIO $ clientRoomM rnc ci

clients :: (ClientInfo -> a) -> StateT ServerState IO a
clients f = do
    (Just ci) <- gets clientIndex
    rnc <- gets roomsClients
    liftIO $ clientsM rnc f ci