Prevent waddle seat IDs going out of sync

Fixes bug where CJ Fire games would become unresponsive after a player has left or lost the game
This commit is contained in:
Ben 2020-08-07 18:06:39 +01:00
parent 82fbd497a7
commit 176a65e0ec

View File

@ -75,12 +75,13 @@ class IWaddle(ABC):
await penguin.join_room(penguin.server.rooms[room_id])
async def remove_penguin(self, p):
self.penguins.remove(p)
self.penguins[self.penguins.index(p)] = None
p.waddle = None
async def send_xt(self, *data, f=None):
for penguin in filter(f, self.penguins):
await penguin.send_xt(*data)
if penguin is not None:
await penguin.send_xt(*data)
def get_seat_id(self, p):
return self.penguins.index(p)