netserver/HWProto.hs
changeset 1332 19ff9bf7d69e
parent 1331 ae291cfd617a
child 1333 b0b0510eb82d
equal deleted inserted replaced
1331:ae291cfd617a 1332:19ff9bf7d69e
   144 handleCmd_inRoom client _ rooms ("ADD_TEAM" : name : color : grave : fort : difStr : hhsInfo)
   144 handleCmd_inRoom client _ rooms ("ADD_TEAM" : name : color : grave : fort : difStr : hhsInfo)
   145 	| length hhsInfo == 16 =
   145 	| length hhsInfo == 16 =
   146 	if length (teams clRoom) == 6 || canAddNumber <= 0 || isJust findTeam then
   146 	if length (teams clRoom) == 6 || canAddNumber <= 0 || isJust findTeam then
   147 		(noChangeClients, noChangeRooms, answerCantAdd)
   147 		(noChangeClients, noChangeRooms, answerCantAdd)
   148 	else
   148 	else
   149 		(noChangeClients, modifyRoom clRoom{teams = newTeam : teams clRoom}, answerTeamAccepted newTeam ++ answerAddTeam newTeam)
   149 		(noChangeClients, modifyRoom clRoom{teams = teams clRoom ++ [newTeam]}, answerTeamAccepted newTeam ++ answerAddTeam newTeam)
   150 	where
   150 	where
   151 		clRoom = roomByName (room client) rooms
   151 		clRoom = roomByName (room client) rooms
   152 		newTeam = (TeamInfo (nick client) name color grave fort difficulty newTeamHHNum (hhsList hhsInfo))
   152 		newTeam = (TeamInfo (nick client) name color grave fort difficulty newTeamHHNum (hhsList hhsInfo))
   153 		findTeam = find (\t -> name == teamname t) $ teams clRoom
   153 		findTeam = find (\t -> name == teamname t) $ teams clRoom
   154 		difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)
   154 		difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)