fixed variable errors
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user