From 2246982f77352f948d08b8aaa670b03849983667 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Sat, 09 Aug 2014 00:51:11 +0000 Subject: Place piece on user click over piece --- diff --git a/dominoactivity.py b/dominoactivity.py index c84da86..166c4e7 100644 --- a/dominoactivity.py +++ b/dominoactivity.py @@ -218,13 +218,18 @@ class Domino(activity.Activity): y = int(event.get_coords()[2]) if self.game.game_state == DominoGame.GAME_STATE_SELECT_PIECE: - for player in self.game.players: - i = 0 - for piece in player.get_pieces(): - if piece.visible and piece.check_touched(x, y): - player.order_piece_selected = i - self.drawingarea.queue_draw() - i += 1 + player = self.game.ui_player + i = 0 + for piece in player.get_pieces(): + if piece.visible and piece.check_touched(x, y): + player.order_piece_selected = i + + if player.place_piece(piece): + player.end_play() + self.draw_pieces() + + self.drawingarea.queue_draw() + i += 1 def draw_pieces(self): self.surface = cairo.ImageSurface( -- cgit v0.9.1