gameServer/Actions.hs
changeset 3742 8461f0cef2e6
parent 3741 73246d25dfe1
child 3947 709fdb89f76c
equal deleted inserted replaced
3740:2e7dda50fddd 3742:8461f0cef2e6
     9 import System.Log.Logger
     9 import System.Log.Logger
    10 import Control.Monad
    10 import Control.Monad
    11 import Data.Time
    11 import Data.Time
    12 import Data.Maybe
    12 import Data.Maybe
    13 import Control.Monad.Reader
    13 import Control.Monad.Reader
    14 import Control.Monad.State
    14 import Control.Monad.State.Strict
    15 import qualified Data.ByteString.Char8 as B
    15 import qualified Data.ByteString.Char8 as B
    16 -----------------------------
    16 -----------------------------
    17 import CoreTypes
    17 import CoreTypes
    18 import Utils
    18 import Utils
    19 import ClientIO
    19 import ClientIO
    55 
    55 
    56 processAction :: Action -> StateT ServerState IO ()
    56 processAction :: Action -> StateT ServerState IO ()
    57 
    57 
    58 
    58 
    59 processAction (AnswerClients chans msg) = do
    59 processAction (AnswerClients chans msg) = do
    60     liftIO (putStr $ "AnswerClients... " ++ (show $ length chans) ++ " (" ++ (show msg) ++")")
    60     liftIO $ map (flip seq ()) chans `seq` map (flip seq ()) msg `seq` mapM_ (flip writeChan msg) chans
    61     liftIO $ map (flip seq ()) chans `seq` mapM_ (flip writeChan msg) chans
       
    62     liftIO (putStrLn "done")
       
    63 
    61 
    64 
    62 
    65 processAction SendServerMessage = do
    63 processAction SendServerMessage = do
    66     chan <- client's sendChan
    64     chan <- client's sendChan
    67     protonum <- client's clientProto
    65     protonum <- client's clientProto