gameServer/HandlerUtils.hs
changeset 6541 08ed346ed341
parent 4989 4771fed9272e
child 9109 878f06e9c484
equal deleted inserted replaced
6540:d04601edf73d 6541:08ed346ed341
    46 thisClientChans :: Reader (ClientIndex, IRnC) [ClientChan]
    46 thisClientChans :: Reader (ClientIndex, IRnC) [ClientChan]
    47 thisClientChans = do
    47 thisClientChans = do
    48     (ci, rnc) <- ask
    48     (ci, rnc) <- ask
    49     return [sendChan (rnc `client` ci)]
    49     return [sendChan (rnc `client` ci)]
    50 
    50 
       
    51 sameProtoChans :: Reader (ClientIndex, IRnC) [ClientChan]
       
    52 sameProtoChans = do
       
    53     (ci, rnc) <- ask
       
    54     let p = clientProto (rnc `client` ci)
       
    55     return . map sendChan . filter (\c -> clientProto c == p) . map (client rnc) $ allClients rnc
       
    56 
    51 answerClient :: [B.ByteString] -> Reader (ClientIndex, IRnC) [Action]
    57 answerClient :: [B.ByteString] -> Reader (ClientIndex, IRnC) [Action]
    52 answerClient msg = liftM ((: []) . flip AnswerClients msg) thisClientChans
    58 answerClient msg = liftM ((: []) . flip AnswerClients msg) thisClientChans
    53 
    59 
    54 allRoomInfos :: Reader (a, IRnC) [RoomInfo]
    60 allRoomInfos :: Reader (a, IRnC) [RoomInfo]
    55 allRoomInfos = liftM ((\irnc -> map (room irnc) $ allRooms irnc) . snd) ask
    61 allRoomInfos = liftM ((\irnc -> map (room irnc) $ allRooms irnc) . snd) ask