gameServer/RoomsAndClients.hs
changeset 3652 df76ccda0648
parent 3645 c0b3f1bb9316
child 3654 18189fbc7530
--- a/gameServer/RoomsAndClients.hs	Sun Jul 18 03:55:56 2010 +0200
+++ b/gameServer/RoomsAndClients.hs	Sun Jul 18 03:58:06 2010 +0200
@@ -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)