gameServer/Actions.hs
changeset 2662 12dc696f1c81
parent 2551 01eb81cd3198
child 2867 9be6693c78cb
equal deleted inserted replaced
2661:9689c6ee9114 2662:12dc696f1c81
    98 		roomClients = IntSet.elems $ playersIDs room
    98 		roomClients = IntSet.elems $ playersIDs room
    99 		room = rooms ! 0
    99 		room = rooms ! 0
   100 
   100 
   101 
   101 
   102 processAction (clID, serverInfo, clients, rooms) (AnswerSameClan msg) = do
   102 processAction (clID, serverInfo, clients, rooms) (AnswerSameClan msg) = do
   103 	mapM_ (\cl -> writeChan (sendChan cl) msg) sameClanClients
   103 	mapM_ (\cl -> writeChan (sendChan cl) msg) sameClanOrSpec
   104 	return (clID, serverInfo, clients, rooms)
   104 	return (clID, serverInfo, clients, rooms)
   105 	where
   105 	where
   106 		otherRoomClients = Prelude.map ((!) clients) $ IntSet.elems $ clID `IntSet.delete` (playersIDs room)
   106 		otherRoomClients = Prelude.map ((!) clients) $ IntSet.elems $ clID `IntSet.delete` (playersIDs room)
       
   107 		sameClanOrSpec = if teamsInGame client > 0 then sameClanClients else spectators
       
   108 		spectators = Prelude.filter (\cl -> teamsInGame cl == 0) otherRoomClients
   107 		sameClanClients = Prelude.filter (\cl -> teamsInGame cl > 0 && clientClan cl == thisClan) otherRoomClients
   109 		sameClanClients = Prelude.filter (\cl -> teamsInGame cl > 0 && clientClan cl == thisClan) otherRoomClients
   108 		thisClan = clientClan client
   110 		thisClan = clientClan client
   109 		room = rooms ! rID
   111 		room = rooms ! rID
   110 		rID = roomID client
   112 		rID = roomID client
   111 		client = clients ! clID
   113 		client = clients ! clID