summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2015-11-30 09:12:40 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 06:41:38 (GMT)
commitcfd851759c367ade3e502bedc9429c03d7c4a669 (patch)
tree7004a65c8b3331a10cfbab377804e4659614d056
parent820cc36bfca23420ea7c3075610724cb686f4d9b (diff)
Player.robsTile is new: try to change player.lastSource only within Player
-rw-r--r--src/message.py2
-rw-r--r--src/player.py5
-rw-r--r--src/server.py2
3 files changed, 6 insertions, 3 deletions
diff --git a/src/message.py b/src/message.py
index f114179..716908a 100644
--- a/src/message.py
+++ b/src/message.py
@@ -704,7 +704,7 @@ class MessageRobbedTheKong(NotifyAtOnceMessage, ServerMessage):
"""mirror the action locally"""
prevMove = next(client.game.lastMoves(only=[Message.DeclaredKong]))
prevMove.player.robTileFrom(prevMove.meld[0].concealed)
- move.player.lastSource = 'k'
+ move.player.robsTile()
client.game.addCsvTag(
'robbedKong%s' % prevMove.meld[1],
forAllPlayers=True)
diff --git a/src/player.py b/src/player.py
index 47a2b29..dde83ce 100644
--- a/src/player.py
+++ b/src/player.py
@@ -684,11 +684,14 @@ class PlayingPlayer(Player):
self.visibleTiles[tile] -= 1
break
else:
- raise Exception('robTile: no meld found with %s' % tile)
+ raise Exception('robTileFrom: no meld found with %s' % tile)
self.game.lastDiscard = tile.concealed
self.lastTile = None # our lastTile has just been robbed
self._hand = None
+ def robsTile(self):
+ self.lastSource = 'k'
+
def scoreMatchesServer(self, score):
"""do we compute the same score as the server does?"""
if score is None:
diff --git a/src/server.py b/src/server.py
index 9626baa..871ff11 100644
--- a/src/server.py
+++ b/src/server.py
@@ -877,7 +877,7 @@ class ServerTable(Table):
lastMove = next(self.game.lastMoves(withoutNotifications=True))
robbedTheKong = lastMove.message == Message.DeclaredKong
if robbedTheKong:
- player.lastSource = 'k'
+ player.robsTile()
withDiscard = lastMove.meld[0].concealed
lastMove.player.robTileFrom(withDiscard)
msgArgs = player.showConcealedMelds(concealedMelds, withDiscard)