netserver/HWProto.hs
changeset 1336 4e88eccbe7f6
parent 1335 c795cbc752c1
child 1338 758c39a3dcfe
equal deleted inserted replaced
1335:c795cbc752c1 1336:4e88eccbe7f6
   157 handleCmd_inRoom client _ rooms ("ADD_TEAM" : name : color : grave : fort : difStr : hhsInfo)
   157 handleCmd_inRoom client _ rooms ("ADD_TEAM" : name : color : grave : fort : difStr : hhsInfo)
   158 	| length hhsInfo == 16 =
   158 	| length hhsInfo == 16 =
   159 	if length (teams clRoom) == 6 || canAddNumber <= 0 || isJust findTeam then
   159 	if length (teams clRoom) == 6 || canAddNumber <= 0 || isJust findTeam then
   160 		(noChangeClients, noChangeRooms, answerCantAdd)
   160 		(noChangeClients, noChangeRooms, answerCantAdd)
   161 	else
   161 	else
   162 		(noChangeClients, modifyRoom clRoom{teams = teams clRoom ++ [newTeam]}, answerTeamAccepted newTeam ++ answerAddTeam newTeam)
   162 		(noChangeClients, modifyRoom clRoom{teams = teams clRoom ++ [newTeam]}, answerTeamAccepted newTeam ++ answerAddTeam newTeam ++ answerTeamColor name color)
   163 	where
   163 	where
   164 		clRoom = roomByName (room client) rooms
   164 		clRoom = roomByName (room client) rooms
   165 		newTeam = (TeamInfo (nick client) name color grave fort difficulty newTeamHHNum (hhsList hhsInfo))
   165 		newTeam = (TeamInfo (nick client) name color grave fort difficulty newTeamHHNum (hhsList hhsInfo))
   166 		findTeam = find (\t -> name == teamname t) $ teams clRoom
   166 		findTeam = find (\t -> name == teamname t) $ teams clRoom
   167 		difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)
   167 		difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)