diff --git a/transcendence/abstract/AbstractRoom.py b/transcendence/abstract/AbstractRoom.py index aceb9af..ddee137 100644 --- a/transcendence/abstract/AbstractRoom.py +++ b/transcendence/abstract/AbstractRoom.py @@ -40,7 +40,7 @@ class AbstractRoom: member.disconnect() def empty(self): - for _ in self._member_list: + for _ in self._waiter_list: return False return True @@ -48,4 +48,4 @@ class AbstractRoom: return [member.user_id for member in self._member_list] def __len__(self): - return len(self._member_list) \ No newline at end of file + return len(self._member_list) diff --git a/transcendence/abstract/AbstractRoomManager.py b/transcendence/abstract/AbstractRoomManager.py index 578102d..2a2efe9 100644 --- a/transcendence/abstract/AbstractRoomManager.py +++ b/transcendence/abstract/AbstractRoomManager.py @@ -5,8 +5,14 @@ class AbstractRoomManager: def __init__(self): self._room_list: [AbstractRoom] = [] - def append(self, room: AbstractRoom): - self._room_list.append(room) - - def remove(self, room: AbstractRoom): - self._room_list.remove(room) \ No newline at end of file + def get(self, mode: int): + for room in self._room_list: + room: A + if (waiting_room._mode == mode): + return waiting_room + tmp: WaitingRoom = WaitingRoom(self, mode) + self._waiting_rooms.append(tmp) + return tmp + + def remove(self, waiting_room: WaitingRoom): + self._waiting_rooms.remove(waiting_room)