75 else |
75 else |
76 [ModifyRoom (\r -> r{teams = teams r ++ [newTeam]}), |
76 [ModifyRoom (\r -> r{teams = teams r ++ [newTeam]}), |
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, |
|
81 AnswerClients roomChans ["TEAM_COLOR", tName, teamColor], |
80 ModifyClient $ \c -> c{actionsPending = actionsPending cl |
82 ModifyClient $ \c -> c{actionsPending = actionsPending cl |
81 ++ [AnswerClients clChan ["HH_NUM", tName, showB $ hhnum newTeam] |
83 ++ [AnswerClients clChan ["HH_NUM", tName, showB $ hhnum newTeam]] |
82 , AnswerClients othChans $ teamToNet $ newTeam |
84 }, |
83 , AnswerClients roomChans ["TEAM_COLOR", tName, teamColor] |
|
84 ]}, |
|
85 AnswerClients [sendChan cl] ["PING"] |
85 AnswerClients [sendChan cl] ["PING"] |
86 ] |
86 ] |
87 where |
87 where |
88 canAddNumber rt = (48::Int) - (sum $ map hhnum rt) |
88 canAddNumber rt = (48::Int) - (sum $ map hhnum rt) |
89 findTeam = find (\t -> tName == teamname t) . teams |
89 findTeam = find (\t -> tName == teamname t) . teams |
227 return [] |
227 return [] |
228 where |
228 where |
229 (legalMsgs, nonEmptyMsgs) = checkNetCmd msg |
229 (legalMsgs, nonEmptyMsgs) = checkNetCmd msg |
230 |
230 |
231 |
231 |
232 handleCmd_inRoom ["ROUNDFINISHED", correctly] = do |
232 handleCmd_inRoom ["ROUNDFINISHED", _] = do |
233 cl <- thisClient |
233 cl <- thisClient |
234 rm <- thisRoom |
234 rm <- thisRoom |
235 chans <- roomClientsChans |
235 chans <- roomClientsChans |
236 |
236 |
237 let clTeams = map teamname . filter (\t -> teamowner t == nick cl) . teams $ rm |
237 let clTeams = map teamname . filter (\t -> teamowner t == nick cl) . teams $ rm |
243 else |
243 else |
244 return unsetInGameState |
244 return unsetInGameState |
245 else |
245 else |
246 return [] -- don't accept this message twice |
246 return [] -- don't accept this message twice |
247 where |
247 where |
248 isCorrect = correctly == "1" |
248 -- isCorrect = correctly == "1" |
249 |
249 |
250 -- compatibility with clients with protocol < 38 |
250 -- compatibility with clients with protocol < 38 |
251 handleCmd_inRoom ["ROUNDFINISHED"] = |
251 handleCmd_inRoom ["ROUNDFINISHED"] = |
252 handleCmd_inRoom ["ROUNDFINISHED", "1"] |
252 handleCmd_inRoom ["ROUNDFINISHED", "1"] |
253 |
253 |