gameServer/HWProtoInRoomState.hs
changeset 8369 31033e521653
parent 8247 d7cf4a9ce685
child 8401 87410ae372f6
equal deleted inserted replaced
8368:6feae8073965 8369:31033e521653
     1 {-# LANGUAGE OverloadedStrings #-}
     1 {-# LANGUAGE OverloadedStrings #-}
     2 module HWProtoInRoomState where
     2 module HWProtoInRoomState where
     3 
     3 
     4 import qualified Data.Map as Map
     4 import qualified Data.Map as Map
     5 import Data.Sequence((|>))
       
     6 import Data.List as L
     5 import Data.List as L
     7 import Data.Maybe
     6 import Data.Maybe
     8 import qualified Data.ByteString.Char8 as B
     7 import qualified Data.ByteString.Char8 as B
     9 import Control.Monad
     8 import Control.Monad
    10 import Control.Monad.Reader
     9 import Control.Monad.Reader
    11 import Control.DeepSeq
       
    12 --------------------------------------
    10 --------------------------------------
    13 import CoreTypes
    11 import CoreTypes
    14 import Actions
    12 import Actions
    15 import Utils
    13 import Utils
    16 import HandlerUtils
    14 import HandlerUtils
   212     cl <- thisClient
   210     cl <- thisClient
   213     rm <- thisRoom
   211     rm <- thisRoom
   214     chans <- roomOthersChans
   212     chans <- roomOthersChans
   215 
   213 
   216     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && isLegal then
   214     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && isLegal then
   217         return $ AnswerClients chans ["EM", msg] : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = roundMsgs g |> msg}) $ gameInfo r}) | not isKeepAlive]
   215         return $ AnswerClients chans ["EM", msg]
       
   216             : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = msg : roundMsgs g}) $ gameInfo r}) | not isKeepAlive]
   218         else
   217         else
   219         return []
   218         return []
   220     where
   219     where
   221         (isLegal, isKeepAlive) = checkNetCmd msg
   220         (isLegal, isKeepAlive) = checkNetCmd msg
   222 
   221