gameServer/HWProtoInRoomState.hs
changeset 1814 e5391d901cff
parent 1813 cfe1481e0247
child 1815 3d62cf9c350e
equal deleted inserted replaced
1813:cfe1481e0247 1814:e5391d901cff
    17 	[AnswerOthersInRoom ["CHAT_STRING", clientNick, msg]]
    17 	[AnswerOthersInRoom ["CHAT_STRING", clientNick, msg]]
    18 	where
    18 	where
    19 		clientNick = nick $ clients IntMap.! clID
    19 		clientNick = nick $ clients IntMap.! clID
    20 
    20 
    21 
    21 
    22 handleCmd_inRoom clID clients _ ["PART"] =
    22 handleCmd_inRoom clID clients rooms ["PART"] =
    23 	if isMaster client then
    23 	if isMaster client then
    24 		[RemoveRoom]
    24 		[RemoveRoom]
    25 	else
    25 	else
    26 		[RoomRemoveThisClient]
    26 		RoomRemoveThisClient
       
    27 		: removeClientTeams
    27 	where
    28 	where
    28 		client = clients IntMap.! clID
    29 		client = clients IntMap.! clID
       
    30 		room = rooms IntMap.! (roomID client)
       
    31 		clientTeams = filter (\t -> teamowner t == nick client) $ teams room
       
    32 		removeClientTeams = map (RemoveTeam . teamname) clientTeams
    29 
    33 
    30 
    34 
    31 handleCmd_inRoom clID clients rooms ("CFG" : paramName : paramStrs) =
    35 handleCmd_inRoom clID clients rooms ("CFG" : paramName : paramStrs) =
    32 	if isMaster client then
    36 	if isMaster client then
    33 		[ModifyRoom (\r -> r{params = Map.insert paramName paramStrs (params r)})
    37 		[ModifyRoom (\r -> r{params = Map.insert paramName paramStrs (params r)})
    34 		, AnswerOthersInRoom ("CFG" : paramName : paramStrs)]
    38 		, AnswerOthersInRoom ("CFG" : paramName : paramStrs)]
    35 	else
    39 	else
    36 		[ProtocolError "Not room master"]
    40 		[ProtocolError "Not room master"]
    37 	where
    41 	where
    38 		client = clients IntMap.! clID
    42 		client = clients IntMap.! clID
    39 
       
    40 
    43 
    41 handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : difStr : hhsInfo)
    44 handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : difStr : hhsInfo)
    42 	| length hhsInfo == 16 =
    45 	| length hhsInfo == 16 =
    43 	if length (teams room) == 6 then
    46 	if length (teams room) == 6 then
    44 		[Warning "too many teams"]
    47 		[Warning "too many teams"]