gameServer/HWProtoInRoomState.hs
changeset 3566 772a46ef8288
parent 3564 7c583c88327b
child 3568 ae89cf0735dc
equal deleted inserted replaced
3565:bc3410104894 3566:772a46ef8288
    46         let r = room rnc $ clientRoom rnc ci
    46         let r = room rnc $ clientRoom rnc ci
    47         clNick <- clientNick
    47         clNick <- clientNick
    48         clChan <- thisClientChans
    48         clChan <- thisClientChans
    49         othersChans <- roomOthersChans
    49         othersChans <- roomOthersChans
    50         return $
    50         return $
    51             if null . drop 5 $ teams r then
    51             if not . null . drop 5 $ teams r then
    52                 [Warning "too many teams"]
    52                 [Warning "too many teams"]
    53             else if canAddNumber r <= 0 then
    53             else if canAddNumber r <= 0 then
    54                 [Warning "too many hedgehogs"]
    54                 [Warning "too many hedgehogs"]
    55             else if isJust $ findTeam r then
    55             else if isJust $ findTeam r then
    56                 [Warning "There's already a team with same name in the list"]
    56                 [Warning "There's already a team with same name in the list"]
    71         newTeam ci clNick r = (TeamInfo ci clNick name color grave fort voicepack flag difficulty (newTeamHHNum r) (hhsList hhsInfo))
    71         newTeam ci clNick r = (TeamInfo ci clNick name color grave fort voicepack flag difficulty (newTeamHHNum r) (hhsList hhsInfo))
    72         difficulty = case B.readInt difStr of
    72         difficulty = case B.readInt difStr of
    73                            Just (i, t) | B.null t -> fromIntegral i
    73                            Just (i, t) | B.null t -> fromIntegral i
    74                            otherwise -> 0
    74                            otherwise -> 0
    75         hhsList [] = []
    75         hhsList [] = []
       
    76         hhsList [_] = error "Hedgehogs list with odd elements number"
    76         hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
    77         hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
    77         newTeamHHNum r = min 4 (canAddNumber r)
    78         newTeamHHNum r = min 4 (canAddNumber r)
    78 
    79 
    79 handleCmd_inRoom ["REMOVE_TEAM", name] = do
    80 handleCmd_inRoom ["REMOVE_TEAM", name] = do
    80         (ci, rnc) <- ask
    81         (ci, rnc) <- ask