Implement "team" chat between spectators
authorunc0rr
Mon, 14 Dec 2009 20:23:51 +0000
changeset 2662 12dc696f1c81
parent 2661 9689c6ee9114
child 2663 d53918cd22bb
Implement "team" chat between spectators
gameServer/Actions.hs
--- a/gameServer/Actions.hs	Mon Dec 14 18:52:04 2009 +0000
+++ b/gameServer/Actions.hs	Mon Dec 14 20:23:51 2009 +0000
@@ -100,10 +100,12 @@
 
 
 processAction (clID, serverInfo, clients, rooms) (AnswerSameClan msg) = do
-	mapM_ (\cl -> writeChan (sendChan cl) msg) sameClanClients
+	mapM_ (\cl -> writeChan (sendChan cl) msg) sameClanOrSpec
 	return (clID, serverInfo, clients, rooms)
 	where
 		otherRoomClients = Prelude.map ((!) clients) $ IntSet.elems $ clID `IntSet.delete` (playersIDs room)
+		sameClanOrSpec = if teamsInGame client > 0 then sameClanClients else spectators
+		spectators = Prelude.filter (\cl -> teamsInGame cl == 0) otherRoomClients
 		sameClanClients = Prelude.filter (\cl -> teamsInGame cl > 0 && clientClan cl == thisClan) otherRoomClients
 		thisClan = clientClan client
 		room = rooms ! rID