equal
deleted
inserted
replaced
62 [Warning "round in progress"] |
62 [Warning "round in progress"] |
63 else if isRestrictedTeams rm then |
63 else if isRestrictedTeams rm then |
64 [Warning "restricted"] |
64 [Warning "restricted"] |
65 else |
65 else |
66 [ModifyRoom (\r -> r{teams = teams r ++ [newTeam ci clNick r]}), |
66 [ModifyRoom (\r -> r{teams = teams r ++ [newTeam ci clNick r]}), |
67 ModifyClient (\c -> c{teamsInGame = teamsInGame c + 1, clientClan = color}), |
67 ModifyClient (\c -> c{teamsInGame = teamsInGame c + 1, clientClan = Just color}), |
68 AnswerClients clChan ["TEAM_ACCEPTED", tName], |
68 AnswerClients clChan ["TEAM_ACCEPTED", tName], |
69 AnswerClients othChans $ teamToNet $ newTeam ci clNick rm, |
69 AnswerClients othChans $ teamToNet $ newTeam ci clNick rm, |
70 AnswerClients othChans ["TEAM_COLOR", tName, color] |
70 AnswerClients othChans ["TEAM_COLOR", tName, color] |
71 ] |
71 ] |
72 where |
72 where |
97 else |
97 else |
98 [RemoveTeam tName, |
98 [RemoveTeam tName, |
99 ModifyClient |
99 ModifyClient |
100 (\c -> c{ |
100 (\c -> c{ |
101 teamsInGame = teamsInGame c - 1, |
101 teamsInGame = teamsInGame c - 1, |
102 clientClan = if teamsInGame c == 1 then undefined else anotherTeamClan ci r |
102 clientClan = if teamsInGame c == 1 then Nothing else Just $ anotherTeamClan ci r |
103 }) |
103 }) |
104 ] |
104 ] |
105 where |
105 where |
106 anotherTeamClan ci = teamcolor . fromJust . find (\t -> teamownerId t == ci) . teams |
106 anotherTeamClan ci = teamcolor . fromJust . find (\t -> teamownerId t == ci) . teams |
107 findTeam = find (\t -> tName == teamname t) . teams |
107 findTeam = find (\t -> tName == teamname t) . teams |
146 else if isNothing maybeTeam then |
146 else if isNothing maybeTeam then |
147 [] |
147 [] |
148 else |
148 else |
149 [ModifyRoom $ modifyTeam team{teamcolor = newColor}, |
149 [ModifyRoom $ modifyTeam team{teamcolor = newColor}, |
150 AnswerClients others ["TEAM_COLOR", teamName, newColor], |
150 AnswerClients others ["TEAM_COLOR", teamName, newColor], |
151 ModifyClient2 (teamownerId team) (\c -> c{clientClan = newColor})] |
151 ModifyClient2 (teamownerId team) (\c -> c{clientClan = Just newColor})] |
152 where |
152 where |
153 findTeam = find (\t -> teamName == teamname t) . teams |
153 findTeam = find (\t -> teamName == teamname t) . teams |
154 |
154 |
155 |
155 |
156 handleCmd_inRoom ["TOGGLE_READY"] = do |
156 handleCmd_inRoom ["TOGGLE_READY"] = do |