25 |
25 |
26 clientRoomA :: StateT ServerState IO RoomIndex |
26 clientRoomA :: StateT ServerState IO RoomIndex |
27 clientRoomA = do |
27 clientRoomA = do |
28 (Just ci) <- gets clientIndex |
28 (Just ci) <- gets clientIndex |
29 rnc <- gets roomsClients |
29 rnc <- gets roomsClients |
30 liftIO $ clientRoomM rnc ci |
30 io $ clientRoomM rnc ci |
31 |
31 |
32 client's :: (ClientInfo -> a) -> StateT ServerState IO a |
32 client's :: (ClientInfo -> a) -> StateT ServerState IO a |
33 client's f = do |
33 client's f = do |
34 (Just ci) <- gets clientIndex |
34 (Just ci) <- gets clientIndex |
35 rnc <- gets roomsClients |
35 rnc <- gets roomsClients |
36 liftIO $ client'sM rnc f ci |
36 io $ client'sM rnc f ci |
37 |
37 |
38 allClientsS :: StateT ServerState IO [ClientInfo] |
38 allClientsS :: StateT ServerState IO [ClientInfo] |
39 allClientsS = gets roomsClients >>= liftIO . clientsM |
39 allClientsS = gets roomsClients >>= liftIO . clientsM |
40 |
40 |
41 roomClientsS :: RoomIndex -> StateT ServerState IO [ClientInfo] |
41 roomClientsS :: RoomIndex -> StateT ServerState IO [ClientInfo] |
42 roomClientsS ri = do |
42 roomClientsS ri = do |
43 rnc <- gets roomsClients |
43 rnc <- gets roomsClients |
44 liftIO $ roomClientsM rnc ri |
44 io $ roomClientsM rnc ri |
45 |
45 |
46 io :: IO a -> StateT ServerState IO a |
46 io :: IO a -> StateT ServerState IO a |
47 io = liftIO |
47 io = liftIO |