netserver/HWProto.hs
changeset 1784 dfe9bafb4590
parent 1757 3aa7d21baca1
equal deleted inserted replaced
1783:169ebeefd7ab 1784:dfe9bafb4590
   397 		newTeam = (TeamInfo (nick client) name color grave fort voicepack difficulty newTeamHHNum (hhsList hhsInfo))
   397 		newTeam = (TeamInfo (nick client) name color grave fort voicepack difficulty newTeamHHNum (hhsList hhsInfo))
   398 		findTeam = find (\t -> name == teamname t) $ teams clRoom
   398 		findTeam = find (\t -> name == teamname t) $ teams clRoom
   399 		difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)
   399 		difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)
   400 		hhsList [] = []
   400 		hhsList [] = []
   401 		hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
   401 		hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
   402 		canAddNumber = 18 - (sum . map hhnum $ teams clRoom)
   402 		canAddNumber = 48 - (sum . map hhnum $ teams clRoom)
   403 		newTeamHHNum = min 4 canAddNumber
   403 		newTeamHHNum = min 4 canAddNumber
   404 
   404 
   405 handleCmd_inRoom client clients rooms ("ADD_TEAM" : name : color : grave : fort : difStr : hhsInfo) =
   405 handleCmd_inRoom client clients rooms ("ADD_TEAM" : name : color : grave : fort : difStr : hhsInfo) =
   406 	handleCmd_inRoom client clients rooms ("ADD_TEAM" : name : color : grave : fort : "Default" : difStr : hhsInfo)
   406 	handleCmd_inRoom client clients rooms ("ADD_TEAM" : name : color : grave : fort : "Default" : difStr : hhsInfo)
   407 
   407 
   418 		hhNumber = fromMaybe 0 (maybeRead numberStr :: Maybe Int)
   418 		hhNumber = fromMaybe 0 (maybeRead numberStr :: Maybe Int)
   419 		noSuchTeam = isNothing findTeam
   419 		noSuchTeam = isNothing findTeam
   420 		team = fromJust findTeam
   420 		team = fromJust findTeam
   421 		findTeam = find (\t -> teamName == teamname t) $ teams clRoom
   421 		findTeam = find (\t -> teamName == teamname t) $ teams clRoom
   422 		clRoom = roomByName (room client) rooms
   422 		clRoom = roomByName (room client) rooms
   423 		canAddNumber = 18 - (sum . map hhnum $ teams clRoom)
   423 		canAddNumber = 48 - (sum . map hhnum $ teams clRoom)
   424 
   424 
   425 handleCmd_inRoom client _ rooms ["TEAM_COLOR", teamName, newColor] =
   425 handleCmd_inRoom client _ rooms ["TEAM_COLOR", teamName, newColor] =
   426 	if not $ isMaster client then
   426 	if not $ isMaster client then
   427 		(noChangeClients, noChangeRooms, answerNotMaster)
   427 		(noChangeClients, noChangeRooms, answerNotMaster)
   428 	else
   428 	else