[gnome-games] glchess: Correctly remove en-passant captured pawn from the board
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] glchess: Correctly remove en-passant captured pawn from the board
- Date: Thu, 12 Jul 2012 21:41:39 +0000 (UTC)
commit 1f4d02dd7a212acd0c7f9f611fcc50483a433098
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Jul 13 09:41:25 2012 +1200
glchess: Correctly remove en-passant captured pawn from the board
glchess/src/chess-game.vala | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/glchess/src/chess-game.vala b/glchess/src/chess-game.vala
index 8212180..09d2541 100644
--- a/glchess/src/chess-game.vala
+++ b/glchess/src/chess-game.vala
@@ -660,22 +660,26 @@ public class ChessState
/* Update board */
board[start] = null;
+ piece_masks[Color.WHITE] &= BitBoard.clear_location_masks[start];
+ piece_masks[Color.BLACK] &= BitBoard.clear_location_masks[start];
if (victim != null)
+ {
board[victim_index] = null;
+ piece_masks[Color.WHITE] &= BitBoard.clear_location_masks[victim_index];
+ piece_masks[Color.BLACK] &= BitBoard.clear_location_masks[victim_index];
+ }
if (is_promotion)
board[end] = new ChessPiece (player, promotion_type);
else
board[end] = piece;
- piece_masks[Color.WHITE] &= BitBoard.clear_location_masks[start];
- piece_masks[Color.BLACK] &= BitBoard.clear_location_masks[start];
piece_masks[color] |= end_mask;
piece_masks[opponent_color] &= BitBoard.clear_location_masks[end];
if (rook_start >= 0)
{
var rook = board[rook_start];
board[rook_start] = null;
- board[rook_end] = rook;
piece_masks[color] &= BitBoard.clear_location_masks[rook_start];
+ board[rook_end] = rook;
piece_masks[color] |= BitBoard.set_location_masks[rook_end];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]