--- a/gameServer/RoomsAndClients.hs Mon Jul 19 22:37:47 2010 +0400
+++ b/gameServer/RoomsAndClients.hs Mon Jul 19 23:00:10 2010 +0400
@@ -19,6 +19,7 @@
room,
client'sM,
room'sM,
+ allClientsM,
clientsM,
roomClientsM,
withRoomsAndClients,
@@ -146,6 +147,9 @@
room'sM :: MRoomsAndClients r c -> (r -> a) -> RoomIndex -> IO a
room'sM (MRoomsAndClients (rooms, _)) f (RoomIndex ri) = liftM (f . room') (rooms `readElem` ri)
+allClientsM :: MRoomsAndClients r c -> IO [ClientIndex]
+allClientsM (MRoomsAndClients (_, clients)) = liftM (map ClientIndex) $ indicesM clients
+
clientsM :: MRoomsAndClients r c -> IO [c]
clientsM (MRoomsAndClients (_, clients)) = indicesM clients >>= mapM (\ci -> liftM client' $ readElem clients ci)