gameServer/RoomsAndClients.hs
changeset 3947 709fdb89f76c
parent 3901 124b4755914b
equal deleted inserted replaced
3946:41e06b74c991 3947:709fdb89f76c
    80     when (ri /= lobbyId) $ error "Empty struct inserts not at firstIndex index"
    80     when (ri /= lobbyId) $ error "Empty struct inserts not at firstIndex index"
    81     return rnc
    81     return rnc
    82 
    82 
    83 
    83 
    84 roomAddClient :: ClientIndex -> Room r -> Room r
    84 roomAddClient :: ClientIndex -> Room r -> Room r
    85 roomAddClient cl room = room{roomClients' = cl : roomClients' room}
    85 roomAddClient cl room = let cls = cl : roomClients' room; nr = room{roomClients' = cls} in cls `seq` nr `seq` nr
    86 
    86 
    87 roomRemoveClient :: ClientIndex -> Room r -> Room r
    87 roomRemoveClient :: ClientIndex -> Room r -> Room r
    88 roomRemoveClient cl room = room{roomClients' = filter (/= cl) $ roomClients' room}
    88 roomRemoveClient cl room = let cls = filter (/= cl) $ roomClients' room; nr = room{roomClients' = cls} in cls `seq` nr `seq` nr
    89 
    89 
    90 
    90 
    91 addRoom :: MRoomsAndClients r c -> r -> IO RoomIndex
    91 addRoom :: MRoomsAndClients r c -> r -> IO RoomIndex
    92 addRoom (MRoomsAndClients (rooms, _)) room = do
    92 addRoom (MRoomsAndClients (rooms, _)) room = do
    93     i <- addElem rooms (Room  [] room)
    93     i <- addElem rooms (Room  [] room)