gnome-games r8999 - in branches/gnome-2-26/glchess/src/lib: chess scene/cairo scene/opengl



Author: rancell
Date: Mon Apr  6 00:22:34 2009
New Revision: 8999
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8999&view=rev

Log:
Fix crash when undoing a pawn promotion (Chris Ball, Bug #577395)


Modified:
   branches/gnome-2-26/glchess/src/lib/chess/board.py
   branches/gnome-2-26/glchess/src/lib/scene/cairo/__init__.py
   branches/gnome-2-26/glchess/src/lib/scene/opengl/opengl.py

Modified: branches/gnome-2-26/glchess/src/lib/chess/board.py
==============================================================================
--- branches/gnome-2-26/glchess/src/lib/chess/board.py	(original)
+++ branches/gnome-2-26/glchess/src/lib/chess/board.py	Mon Apr  6 00:22:34 2009
@@ -793,7 +793,7 @@
         
         'piece' is the piece being moved.
         'start' is the start location of the piece (tuple (file,rank) or None if the piece is being created.
-        'end' is the end location of the piece (tuple (file,rank)
+        'end' is the end location of the piece (tuple (file,rank))
         'delete' is a flag to show if the piece should be deleted when it arrives there (boolean).
         """
         pass

Modified: branches/gnome-2-26/glchess/src/lib/scene/cairo/__init__.py
==============================================================================
--- branches/gnome-2-26/glchess/src/lib/scene/cairo/__init__.py	(original)
+++ branches/gnome-2-26/glchess/src/lib/scene/cairo/__init__.py	Mon Apr  6 00:22:34 2009
@@ -60,6 +60,11 @@
 
     def move(self, coord, delete, animate = True):
         """Extends glchess.scene.ChessPiece"""
+        if not coord:
+            self.scene.pieces.remove(self)
+            self.feedback.onDeleted()
+            return
+        
         self.coord = coord
         self.delete = delete
         self.targetPos = self.__coordToLocation(coord)

Modified: branches/gnome-2-26/glchess/src/lib/scene/opengl/opengl.py
==============================================================================
--- branches/gnome-2-26/glchess/src/lib/scene/opengl/opengl.py	(original)
+++ branches/gnome-2-26/glchess/src/lib/scene/opengl/opengl.py	Mon Apr  6 00:22:34 2009
@@ -109,6 +109,11 @@
 
     def move(self, coord, delete, animate = True):
         """Extends glchess.scene.ChessPiece"""
+        if not coord:
+            self.scene.pieces.remove(self)
+            self.feedback.onDeleted()
+            return
+
         self.delete = delete
         self.location = coord
         self.targetPos = self.scene._coordToLocation(coord)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]