From ed6861a7f4b25b8e95dffeab61a356bb4efc41c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Mon, 6 May 2019 13:48:04 +0300 Subject: [PATCH] Fix a bug if we lose all players during setup --- gameloop.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gameloop.py b/gameloop.py index ac620d6..ad5a428 100644 --- a/gameloop.py +++ b/gameloop.py @@ -213,7 +213,8 @@ def game(send, notice, get_event): elif event == events.nick_change: old, new = args - change_player_nick(old, new) + if old in players: + change_player_nick(old, new) elif event == events.join: nick, = args @@ -318,13 +319,13 @@ def game(send, notice, get_event): players_ready = set() while True: - players_unready = [i for i in players.values() if i not in players_ready] - if len(players_unready) == 0: break - if len(players) == 0: send('Lost all players, quiting game setup') return no_game + players_unready = [i for i in players.values() if i not in players_ready] + if len(players_unready) == 0: break + event, *args = get_event() if event == events.status: