summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-06-04 04:43:08 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-06-04 04:43:08 +0100
commit830cd3a4733d59935ec7718aa4262d134dc4786a (patch)
tree2c77efcf2f12eff187eb3ca9bb8652173dd61788
parent027b5f1aceef632a094fd16a3c27106b0644adf5 (diff)
fixed: client considered in game even when refused
the bug happened when we tried to join a full game. the client had game field set to the actual game even though it is not supposed to participate. Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r--CAO_Client.py8
-rw-r--r--CAO_Game.py1
2 files changed, 7 insertions, 2 deletions
diff --git a/CAO_Client.py b/CAO_Client.py
index 67ce54f..6eccc2d 100644
--- a/CAO_Client.py
+++ b/CAO_Client.py
@@ -12,9 +12,13 @@ class CAO_Client():
if self.game is not None:
return cao_error('You are already in a game')
- self.game = self.game_manager.join_game(game_name)
- return self.game.try_join(self)
+ game = self.game_manager.join_game(game_name)
+ # XXX self.game will be assigned by game.try_join()
+ return game.try_join(self)
+
+ def set_game(self, game):
+ self.game = game
def set_player(self, player):
self.player = player
diff --git a/CAO_Game.py b/CAO_Game.py
index 54bbf48..fda7707 100644
--- a/CAO_Game.py
+++ b/CAO_Game.py
@@ -40,6 +40,7 @@ class CAO_Game():
player = CAO_Player(client, cards)
client.set_player(player)
+ client.set_game(self)
self.players.append(player)