gameServer/HWProtoInRoomState.hs
changeset 2245 c011aecc95e5
parent 2207 aeea95909aba
child 2304 a6e733ad0366
--- a/gameServer/HWProtoInRoomState.hs	Thu Jul 09 00:56:26 2009 +0000
+++ b/gameServer/HWProtoInRoomState.hs	Thu Jul 09 14:36:41 2009 +0000
@@ -58,6 +58,7 @@
 		[Warning "restricted"]
 	else
 		[ModifyRoom (\r -> r{teams = teams r ++ [newTeam]}),
+		ModifyClient (\c -> c{teamsInGame = teamsInGame c + 1}),
 		AnswerThisClient ["TEAM_ACCEPTED", name],
 		AnswerOthersInRoom $ teamToNet newTeam,
 		AnswerOthersInRoom ["TEAM_COLOR", name, color]
@@ -81,7 +82,9 @@
 		if not $ nick client == teamowner team then
 			[ProtocolError "Not team owner!"]
 		else
-			[RemoveTeam teamName]
+			[RemoveTeam teamName,
+			ModifyClient (\c -> c{teamsInGame = teamsInGame c - 1})	
+			]
 	where
 		client = clients IntMap.! clID
 		room = rooms IntMap.! (roomID client)
@@ -155,10 +158,14 @@
 		enoughClans = not $ null $ drop 1 $ group $ map teamcolor $ teams room
 
 
-handleCmd_inRoom _ _ rooms ["EM", msg] =
-	[ModifyRoom (\r -> r{roundMsgs = roundMsgs r |> msg}),
-	AnswerOthersInRoom ["EM", msg]]
-
+handleCmd_inRoom clID clients rooms ["EM", msg] =
+	if teamsInGame client > 0 then
+		[ModifyRoom (\r -> r{roundMsgs = roundMsgs r |> msg}),
+		AnswerOthersInRoom ["EM", msg]]
+	else
+		[]
+	where
+		client = clients IntMap.! clID
 
 handleCmd_inRoom clID clients rooms ["ROUNDFINISHED"] =
 	if isMaster client then