gameServer/HWProtoLobbyState.hs
changeset 4917 8ff92bdc9f98
parent 4914 5c33bb53c1e5
child 4932 f11d80bac7ed
equal deleted inserted replaced
4916:33c1e9bc68ad 4917:8ff92bdc9f98
    60         return $ if isJust $ find (\room -> newRoom == name room) rs then 
    60         return $ if isJust $ find (\room -> newRoom == name room) rs then 
    61             [Warning "Room exists"]
    61             [Warning "Room exists"]
    62             else
    62             else
    63             [
    63             [
    64                 AddRoom newRoom roomPassword,
    64                 AddRoom newRoom roomPassword,
    65                 AnswerClients [sendChan cl] ["NOT_READY", nick cl]
    65                 AnswerClients [sendChan cl] ["CLIENT_FLAGS", "-r", nick cl]
    66             ]
    66             ]
    67 
    67 
    68 
    68 
    69 handleCmd_lobby ["CREATE_ROOM", newRoom] =
    69 handleCmd_lobby ["CREATE_ROOM", newRoom] =
    70     handleCmd_lobby ["CREATE_ROOM", newRoom, ""]
    70     handleCmd_lobby ["CREATE_ROOM", newRoom, ""]
    89             [Warning "Wrong password"]
    89             [Warning "Wrong password"]
    90             else
    90             else
    91             [
    91             [
    92                 MoveToRoom jRI,
    92                 MoveToRoom jRI,
    93                 AnswerClients [sendChan cl] $ "JOINED" : nicks,
    93                 AnswerClients [sendChan cl] $ "JOINED" : nicks,
    94                 AnswerClients chans ["NOT_READY", nick cl]
    94                 AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl]
    95             ]
    95             ]
    96             ++ (map (readynessMessage cl) jRoomClients)
    96             ++ (map (readynessMessage cl) jRoomClients)
    97             ++ (answerFullConfig cl $ params jRoom)
    97             ++ (answerFullConfig cl $ params jRoom)
    98             ++ (answerTeams cl jRoom)
    98             ++ (answerTeams cl jRoom)
    99             ++ (watchRound cl jRoom)
    99             ++ (watchRound cl jRoom)
   100 
   100 
   101         where
   101         where
   102         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
   102         readynessMessage cl c = AnswerClients [sendChan cl] ["CLIENT_FLAGS", if isReady c then "+r" else "-r", nick c]
   103 
   103 
   104         toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
   104         toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
   105 
   105 
   106         answerFullConfig cl params = map (toAnswer cl) (leftConfigPart ++ rightConfigPart)
   106         answerFullConfig cl params = map (toAnswer cl) (leftConfigPart ++ rightConfigPart)
   107             where
   107             where