gameServer/HWProtoLobbyState.hs
changeset 6541 08ed346ed341
parent 6191 190a8e5d9956
child 6912 831416764d2d
equal deleted inserted replaced
6540:d04601edf73d 6541:08ed346ed341
    22         toAnswer team =
    22         toAnswer team =
    23             [AnswerClients [clChan] $ teamToNet team,
    23             [AnswerClients [clChan] $ teamToNet team,
    24             AnswerClients [clChan] ["TEAM_COLOR", teamname team, teamcolor team],
    24             AnswerClients [clChan] ["TEAM_COLOR", teamname team, teamcolor team],
    25             AnswerClients [clChan] ["HH_NUM", teamname team, showB $ hhnum team]]
    25             AnswerClients [clChan] ["HH_NUM", teamname team, showB $ hhnum team]]
    26 
    26 
       
    27 
    27 handleCmd_lobby :: CmdHandler
    28 handleCmd_lobby :: CmdHandler
    28 
    29 
    29 
    30 
    30 handleCmd_lobby ["LIST"] = do
    31 handleCmd_lobby ["LIST"] = do
    31     (ci, irnc) <- ask
    32     (ci, irnc) <- ask
    32     let cl = irnc `client` ci
    33     let cl = irnc `client` ci
    33     rooms <- allRoomInfos
    34     rooms <- allRoomInfos
    34     let roomsInfoList = concatMap (roomInfo irnc) . filter (\r -> (roomProto r == clientProto cl) && not (isRestrictedJoins r))
    35     let roomsInfoList = concatMap (\r -> roomInfo (nick $ irnc `client` masterID r) r) . filter (\r -> (roomProto r == clientProto cl))
    35     return [AnswerClients [sendChan cl] ("ROOMS" : roomsInfoList rooms)]
    36     return [AnswerClients [sendChan cl] ("ROOMS" : roomsInfoList rooms)]
    36     where
       
    37         roomInfo irnc r = [
       
    38                 showB $ isJust $ gameInfo r,
       
    39                 name r,
       
    40                 showB $ playersIn r,
       
    41                 showB $ length $ teams r,
       
    42                 nick $ irnc `client` masterID r,
       
    43                 Map.findWithDefault "+rnd+" "MAP" (mapParams r),
       
    44                 head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
       
    45                 head (Map.findWithDefault ["Default"] "AMMO" (params r))
       
    46                 ]
       
    47 
    37 
    48 
    38 
    49 handleCmd_lobby ["CHAT", msg] = do
    39 handleCmd_lobby ["CHAT", msg] = do
    50     n <- clientNick
    40     n <- clientNick
    51     s <- roomOthersChans
    41     s <- roomOthersChans