gameServer/RoomsAndClients.hs
changeset 3742 8461f0cef2e6
parent 3741 73246d25dfe1
child 3747 76a197793b62
equal deleted inserted replaced
3740:2e7dda50fddd 3742:8461f0cef2e6
    13     lobbyId,
    13     lobbyId,
    14     moveClientToLobby,
    14     moveClientToLobby,
    15     moveClientToRoom,
    15     moveClientToRoom,
    16     clientRoom,
    16     clientRoom,
    17     clientRoomM,
    17     clientRoomM,
       
    18     clientExists,
    18     client,
    19     client,
    19     room,
    20     room,
    20     client'sM,
    21     client'sM,
    21     room'sM,
    22     room'sM,
    22     allClientsM,
    23     allClientsM,
   137 
   138 
   138 moveClientToRoom :: MRoomsAndClients r c -> RoomIndex -> ClientIndex -> IO ()
   139 moveClientToRoom :: MRoomsAndClients r c -> RoomIndex -> ClientIndex -> IO ()
   139 moveClientToRoom rnc ri ci = moveClientInRooms rnc lobbyId ri ci
   140 moveClientToRoom rnc ri ci = moveClientInRooms rnc lobbyId ri ci
   140 
   141 
   141 
   142 
       
   143 clientExists :: MRoomsAndClients r c -> ClientIndex -> IO Bool
       
   144 clientExists (MRoomsAndClients (_, clients)) (ClientIndex ci) = elemExists clients ci
       
   145 
   142 clientRoomM :: MRoomsAndClients r c -> ClientIndex -> IO RoomIndex
   146 clientRoomM :: MRoomsAndClients r c -> ClientIndex -> IO RoomIndex
   143 clientRoomM (MRoomsAndClients (_, clients)) (ClientIndex ci) = liftM clientRoom' (clients `readElem` ci)
   147 clientRoomM (MRoomsAndClients (_, clients)) (ClientIndex ci) = liftM clientRoom' (clients `readElem` ci)
   144 
   148 
   145 client'sM :: MRoomsAndClients r c -> (c -> a) -> ClientIndex -> IO a
   149 client'sM :: MRoomsAndClients r c -> (c -> a) -> ClientIndex -> IO a
   146 client'sM (MRoomsAndClients (_, clients)) f (ClientIndex ci) = liftM (f . client') (clients `readElem` ci)
   150 client'sM (MRoomsAndClients (_, clients)) f (ClientIndex ci) = liftM (f . client') (clients `readElem` ci)