gameServer/RoomsAndClients.hs
changeset 3645 c0b3f1bb9316
parent 3566 772a46ef8288
child 3654 18189fbc7530
--- a/gameServer/RoomsAndClients.hs	Thu Jul 15 04:31:25 2010 +0200
+++ b/gameServer/RoomsAndClients.hs	Sat Jul 17 23:44:42 2010 +0400
@@ -18,6 +18,7 @@
     client,
     room,
     client'sM,
+    room'sM,
     clientsM,
     roomClientsM,
     withRoomsAndClients,
@@ -142,6 +143,9 @@
 client'sM :: MRoomsAndClients r c -> (c -> a) -> ClientIndex -> IO a
 client'sM (MRoomsAndClients (_, clients)) f (ClientIndex ci) = liftM (f . client') (clients `readElem` ci)
 
+room'sM :: MRoomsAndClients r c -> (r -> a) -> RoomIndex -> IO a
+room'sM (MRoomsAndClients (rooms, _)) f (RoomIndex ri) = liftM (f . room') (rooms `readElem` ri)
+
 clientsM :: MRoomsAndClients r c -> IO [c]
 clientsM (MRoomsAndClients (_, clients)) = indicesM clients >>= mapM (\ci -> liftM client' $ readElem clients ci)