[gnome-games] glchess: Only allow pawns to do en passant



commit 1112028ee2899b151a2a0b1bb6f9e281c3403e26
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Jul 13 09:27:18 2012 +1200

    glchess: Only allow pawns to do en passant

 glchess/src/chess-game.vala |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/glchess/src/chess-game.vala b/glchess/src/chess-game.vala
index ecd8b83..8212180 100644
--- a/glchess/src/chess-game.vala
+++ b/glchess/src/chess-game.vala
@@ -541,13 +541,6 @@ public class ChessState
         if (victim != null && victim.player == player)
             return false;
 
-        /* Check if taking an marched pawn */
-        if (victim == null && end == en_passant_index)
-        {
-            victim_index = get_index (r1 == 2 ? 3 : 4, f1);
-            victim = board[victim_index];
-        }
-
         /* Check special moves */
         int rook_start = -1, rook_end = -1;
         bool is_promotion = false;
@@ -556,6 +549,13 @@ public class ChessState
         switch (piece.type)
         {
         case PieceType.PAWN:
+            /* Check if taking an marched pawn */
+            if (victim == null && end == en_passant_index)
+            {
+                victim_index = get_index (r1 == 2 ? 3 : 4, f1);
+                victim = board[victim_index];
+            }
+
             /* If moving diagonally there must be a victim */
             if (f0 != f1)
             {



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