cleaned up code

This commit is contained in:
2024-01-14 18:41:45 +01:00
parent 15cce52aea
commit 96df962227
2 changed files with 28 additions and 4 deletions

View File

@ -87,13 +87,17 @@ class GameManager:
# creates a player and handles counting all players and if conditions met starting the game
# returns the new dict in which the new player now is added
def addPlayers(self, player:Player, socket:socket, clientAddr) -> dict:
self.__gameManager.getLogger().info(f"creating user with id: {player.getID}")
self.__players[clientAddr] = {
player: player,
socket:socket
}
self.__gameManager.getLogger().info(f"new length of user dictionary: {len(self.__players)}")
# counts participating players and starts the game if enough have joined
if len(self.__players) == 2:
self.__gameManager.getLogger().info("2 players have join game starts")
self.startGame(socket)
return self.__players