gameServer/HWProtoLobbyState.hs
changeset 9787 0da6ba2f1f93
parent 9753 9579596cf471
child 10092 a92a4ba39a79
equal deleted inserted replaced
9786:e33ee5ef5d9d 9787:0da6ba2f1f93
    77             [NoticeMessage WrongPassword]
    77             [NoticeMessage WrongPassword]
    78             else
    78             else
    79             (
    79             (
    80                 MoveToRoom jRI
    80                 MoveToRoom jRI
    81                 : ModifyClient (\c -> c{isJoinedMidGame = isJust $ gameInfo jRoom})
    81                 : ModifyClient (\c -> c{isJoinedMidGame = isJust $ gameInfo jRoom})
    82                 : (AnswerClients [sendChan cl] $ "JOINED" : nicks)
       
    83                 : AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl]
    82                 : AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl]
    84                 : [AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", nick $ fromJust owner] | isJust owner]
    83                 : [(AnswerClients [sendChan cl] $ "JOINED" : nicks) | not $ null nicks]
    85             )
    84             )
    86             ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients])
    85             ++ [AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+h", nick $ fromJust owner] | isJust owner]
       
    86             ++ [sendStateFlags cl jRoomClients | not $ null jRoomClients]
    87             ++ answerFullConfig cl jRoom
    87             ++ answerFullConfig cl jRoom
    88             ++ answerTeams cl jRoom
    88             ++ answerTeams cl jRoom
    89             ++ watchRound cl jRoom chans
    89             ++ watchRound cl jRoom chans
    90             ++ []
    90             ++ [AnswerClients [sendChan cl] ["CHAT", "[greeting]", greeting jRoom] | greeting jRoom /= ""]
    91 
    91 
    92         where
    92         where
    93         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
       
    94         sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $
    93         sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $
    95                 [f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby]
    94                 [f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby]
    96             where
    95             where
    97             (ready, unready) = partition isReady clients
    96             (ready, unready) = partition isReady clients
    98             (ingame, inroomlobby) = partition isInGame clients
    97             (ingame, inroomlobby) = partition isInGame clients