Error in case of 11th join (game started)

Added a maximum of 10 player as specified in UNO official rules.
This also prevents a deck empty error in case too much players have joined the game.
This commit is contained in:
DO97 2019-06-16 17:34:15 +02:00 committed by GitHub
parent 30b6680e6b
commit 687b72edf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,7 @@ import logging
from game import Game
from player import Player
from errors import (AlreadyJoinedError, LobbyClosedError, NoGameInChatError,
NotEnoughPlayersError)
NotEnoughPlayersError, MaxPlayersError)
class GameManager(object):
@ -69,6 +69,9 @@ class GameManager(object):
if not game.open:
raise LobbyClosedError()
if game.started and len(game.players) == 10:
raise MaxPlayersError()
if user.id not in self.userid_players:
self.userid_players[user.id] = list()