gameServer/HWProtoLobbyState.hs
branchwebgl
changeset 9127 e350500c4edb
parent 9035 e84d42a4311c
child 9109 878f06e9c484
equal deleted inserted replaced
8860:bde641cf53c8 9127:e350500c4edb
    90                 , AnswerClients [sendChan cl] $ "JOINED" : nicks
    90                 , AnswerClients [sendChan cl] $ "JOINED" : nicks
    91                 , AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl]
    91                 , AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl]
    92                 , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick]
    92                 , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick]
    93             ]
    93             ]
    94             ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients])
    94             ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients])
    95             ++ [AnswerClients [sendChan cl] ["PING"]
    95             ++ answerFullConfig cl (mapParams jRoom) (params jRoom)
    96                 , ModifyClient $ \c -> c{actionsPending = actionsPending cl
    96             ++ answerTeams cl jRoom
    97                     ++ answerFullConfig cl (mapParams jRoom) (params jRoom)
    97             ++ watchRound cl jRoom chans
    98                     ++ answerTeams cl jRoom
       
    99                     ++ watchRound cl jRoom chans}
       
   100                 ]
       
   101 
    98 
   102         where
    99         where
   103         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
   100         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
   104         sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $
   101         sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $
   105                 [f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby]
   102                 [f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby]
   145     if isNothing ci || ri == lobbyId then
   142     if isNothing ci || ri == lobbyId then
   146         return []
   143         return []
   147         else
   144         else
   148         liftM ((:) (AnswerClients [clChan] ["JOINING", roomName])) $ handleCmd_lobby ["JOIN_ROOM", roomName]
   145         liftM ((:) (AnswerClients [clChan] ["JOINING", roomName])) $ handleCmd_lobby ["JOIN_ROOM", roomName]
   149 
   146 
       
   147 
       
   148 handleCmd_lobby ("RND":rs) = do
       
   149     c <- liftM sendChan thisClient
       
   150     return [Random [c] rs]
       
   151 
   150     ---------------------------
   152     ---------------------------
   151     -- Administrator's stuff --
   153     -- Administrator's stuff --
   152 
   154 
   153 handleCmd_lobby ["KICK", kickNick] = do
   155 handleCmd_lobby ["KICK", kickNick] = do
   154     (ci, _) <- ask
   156     (ci, _) <- ask