From: Marco Costalba Date: Sun, 13 Sep 2009 15:13:49 +0000 (+0100) Subject: Fix semantic of piece_attacks X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=6709b01903b9122cf619e8469a0bea96097447e7;ds=sidebyside Fix semantic of piece_attacks Return the bitboard with the pawn attacks for both colors so to be aligned to the meaning of the others piece_attacks templates. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/position.cpp b/src/position.cpp index 8ec82beb..462088e0 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -667,7 +667,7 @@ inline void Position::update_checkers(Bitboard* pCheckersBB, Square ksq, Square else if ( Piece != KING && !Slider - && bit_is_set(piece_attacks(ksq), to)) + && bit_is_set(Piece == PAWN ? pawn_attacks(opposite_color(sideToMove), ksq) : piece_attacks(ksq), to)) set_bit(pCheckersBB, to); // Discovery checks diff --git a/src/position.h b/src/position.h index 0006fbc7..11cdc132 100644 --- a/src/position.h +++ b/src/position.h @@ -457,7 +457,7 @@ inline Bitboard Position::piece_attacks(Square s) const { template<> inline Bitboard Position::piece_attacks(Square s) const { - return StepAttackBB[piece_of_color_and_type(opposite_color(sideToMove), PAWN)][s]; + return StepAttackBB[WP][s] | StepAttackBB[BP][s]; } template<>