fixed variable errors

This commit is contained in:
2024-01-14 21:13:03 +01:00
parent b98b9821dc
commit 160fce0484
16 changed files with 42 additions and 13 deletions

View File

@@ -66,7 +66,7 @@ class GameManager:
tcpSocket.send(json.dumps(payload).encode())
except Exception as e:
print(f"failed to start game due to error: {e}")
self.logger.error(f"failed to start game due to error: {e}")
break
# handles notifying all players that the game starts
pass
@@ -88,16 +88,16 @@ class GameManager:
# 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.logger.info(f"creating user with id: {player.getID}")
self.__players[clientAddr] = {
player: player,
socket:socket
"player": player,
"socket":socket
}
self.__gameManager.getLogger().info(f"new length of user dictionary: {len(self.__players)}")
self.logger.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.logger.info("2 players have join game starts")
self.startGame(socket)
return self.__players