gameServer/RoomsAndClients.hs
changeset 3458 11cd56019f00
parent 3436 288fcbdb77b6
child 3501 a3159a410e5c
--- a/gameServer/RoomsAndClients.hs	Mon May 10 15:31:09 2010 +0000
+++ b/gameServer/RoomsAndClients.hs	Mon May 10 17:48:06 2010 +0000
@@ -16,6 +16,7 @@
     clientRoom,
     clientRoomM,
     client,
+    clientsM,
     allClients,
     withRoomsAndClients,
     showRooms,
@@ -135,6 +136,9 @@
 clientRoomM :: MRoomsAndClients r c -> ClientIndex -> IO RoomIndex
 clientRoomM (MRoomsAndClients (_, clients)) (ClientIndex ci) = liftM clientRoom' (clients `readElem` ci)
 
+clientsM :: MRoomsAndClients r c -> (c -> a) -> ClientIndex -> IO a
+clientsM (MRoomsAndClients (_, clients)) f (ClientIndex ci) = liftM (f . client') (clients `readElem` ci)
+
 
 withRoomsAndClients :: MRoomsAndClients r c -> (IRoomsAndClients r c -> a) -> IO a
 withRoomsAndClients (MRoomsAndClients (rooms, clients)) f =