gameServer/HWProtoLobbyState.hs
changeset 8401 87410ae372f6
parent 8369 31033e521653
child 8403 fbc6e7602e05
equal deleted inserted replaced
8400:33ab77c0b486 8401:87410ae372f6
    39     n <- clientNick
    39     n <- clientNick
    40     s <- roomOthersChans
    40     s <- roomOthersChans
    41     return [AnswerClients s ["CHAT", n, msg]]
    41     return [AnswerClients s ["CHAT", n, msg]]
    42 
    42 
    43 handleCmd_lobby ["CREATE_ROOM", rName, roomPassword]
    43 handleCmd_lobby ["CREATE_ROOM", rName, roomPassword]
    44     | illegalName rName = return [Warning "Illegal room name"]
    44     | illegalName rName = return [Warning $ loc "Illegal room name"]
    45     | otherwise = do
    45     | otherwise = do
    46         rs <- allRoomInfos
    46         rs <- allRoomInfos
    47         cl <- thisClient
    47         cl <- thisClient
    48         return $ if isJust $ find (\r -> rName == name r) rs then
    48         return $ if isJust $ find (\r -> rName == name r) rs then
    49             [Warning "Room exists"]
    49             [Warning "Room exists"]
    73     let ownerNick = nick . fromJust $ find isMaster jRoomClients
    73     let ownerNick = nick . fromJust $ find isMaster jRoomClients
    74     let chans = map sendChan (cl : jRoomClients)
    74     let chans = map sendChan (cl : jRoomClients)
    75     let isBanned = host cl `elem` roomBansList jRoom
    75     let isBanned = host cl `elem` roomBansList jRoom
    76     return $
    76     return $
    77         if isNothing maybeRI || not sameProto then
    77         if isNothing maybeRI || not sameProto then
    78             [Warning "No such room"]
    78             [Warning $ loc "No such room"]
    79             else if isRestrictedJoins jRoom then
    79             else if isRestrictedJoins jRoom then
    80             [Warning "Joining restricted"]
    80             [Warning $ loc "Joining restricted"]
    81             else if isRegisteredOnly jRoom then
    81             else if isRegisteredOnly jRoom then
    82             [Warning "Registered users only"]
    82             [Warning $ loc "Registered users only"]
    83             else if isBanned then
    83             else if isBanned then
    84             [Warning "You are banned in this room"]
    84             [Warning $ loc "You are banned in this room"]
    85             else if roomPassword /= password jRoom then
    85             else if roomPassword /= password jRoom then
    86             [NoticeMessage WrongPassword]
    86             [NoticeMessage WrongPassword]
    87             else
    87             else
    88             [
    88             [
    89                 MoveToRoom jRI
    89                 MoveToRoom jRI