gameServer/HandlerUtils.hs
changeset 4986 33fe91b2bcbf
parent 4975 31da8979e5b1
child 4989 4771fed9272e
equal deleted inserted replaced
4985:304d149bb3dd 4986:33fe91b2bcbf
    32 roomSameClanChans = do
    32 roomSameClanChans = do
    33     (ci, rnc) <- ask
    33     (ci, rnc) <- ask
    34     let ri = clientRoom rnc ci
    34     let ri = clientRoom rnc ci
    35     let otherRoomClients = map (client rnc) . filter (/= ci) $ roomClients rnc ri
    35     let otherRoomClients = map (client rnc) . filter (/= ci) $ roomClients rnc ri
    36     let cl = rnc `client` ci
    36     let cl = rnc `client` ci
    37     let thisClan = clientClan cl
    37     let sameClanClients = Prelude.filter (\c -> clientClan c == clientClan cl) otherRoomClients
    38     let sameClanClients = Prelude.filter (\c -> teamsInGame cl > 0 && clientClan c == thisClan) otherRoomClients
    38     return $ map sendChan sameClanClients
    39     let spectators = Prelude.filter (\c -> teamsInGame c == 0) otherRoomClients
       
    40     let sameClanOrSpec = if teamsInGame cl > 0 then sameClanClients else spectators
       
    41     return $ map sendChan sameClanOrSpec
       
    42 
    39 
    43 roomClientsChans :: Reader (ClientIndex, IRnC) [ClientChan]
    40 roomClientsChans :: Reader (ClientIndex, IRnC) [ClientChan]
    44 roomClientsChans = do
    41 roomClientsChans = do
    45     (ci, rnc) <- ask
    42     (ci, rnc) <- ask
    46     let ri = clientRoom rnc ci
    43     let ri = clientRoom rnc ci