equal
deleted
inserted
replaced
57 if clientProto cl < 42 then |
57 if clientProto cl < 42 then |
58 return color |
58 return color |
59 else |
59 else |
60 liftM (head . (L.\\) (map B.singleton ['0'..]) . map teamcolor . teams) thisRoom |
60 liftM (head . (L.\\) (map B.singleton ['0'..]) . map teamcolor . teams) thisRoom |
61 let roomTeams = teams rm |
61 let roomTeams = teams rm |
62 let hhNum = let p = if not $ null roomTeams then hhnum $ head roomTeams else 4 in newTeamHHNum roomTeams p |
62 let hhNum = let p = if not $ null roomTeams then minimum [hhnum $ head roomTeams, canAddNumber roomTeams] else 4 in newTeamHHNum roomTeams p |
63 let newTeam = clNick `seq` TeamInfo ci clNick tName teamColor grave fort voicepack flag dif hhNum (hhsList hhsInfo) |
63 let newTeam = clNick `seq` TeamInfo ci clNick tName teamColor grave fort voicepack flag dif hhNum (hhsList hhsInfo) |
64 return $ |
64 return $ |
65 if not . null . drop (maxTeams rm - 1) $ roomTeams then |
65 if not . null . drop (maxTeams rm - 1) $ roomTeams then |
66 [Warning $ loc "too many teams"] |
66 [Warning $ loc "too many teams"] |
67 else if canAddNumber roomTeams <= 0 then |
67 else if canAddNumber roomTeams <= 0 then |
77 SendUpdateOnThisRoom, |
77 SendUpdateOnThisRoom, |
78 ModifyClient (\c -> c{teamsInGame = teamsInGame c + 1, clientClan = Just teamColor}), |
78 ModifyClient (\c -> c{teamsInGame = teamsInGame c + 1, clientClan = Just teamColor}), |
79 AnswerClients clChan ["TEAM_ACCEPTED", tName], |
79 AnswerClients clChan ["TEAM_ACCEPTED", tName], |
80 AnswerClients othChans $ teamToNet $ newTeam, |
80 AnswerClients othChans $ teamToNet $ newTeam, |
81 AnswerClients roomChans ["TEAM_COLOR", tName, teamColor], |
81 AnswerClients roomChans ["TEAM_COLOR", tName, teamColor], |
82 ModifyClient $ \c -> c{actionsPending = actionsPending cl |
82 AnswerClients roomChans ["HH_NUM", tName, showB $ hhnum newTeam], |
83 ++ [AnswerClients clChan ["HH_NUM", tName, showB $ hhnum newTeam]] |
|
84 }, |
|
85 AnswerClients [sendChan cl] ["PING"] |
83 AnswerClients [sendChan cl] ["PING"] |
86 ] |
84 ] |
87 where |
85 where |
88 canAddNumber rt = (48::Int) - (sum $ map hhnum rt) |
86 canAddNumber rt = (48::Int) - (sum $ map hhnum rt) |
89 findTeam = find (\t -> tName == teamname t) . teams |
87 findTeam = find (\t -> tName == teamname t) . teams |