X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.h;h=ceebce1c61c79e47683338ce7d913c6e8b1bb38c;hb=c45818e9f86fea63a6b46d0726cdcfe87516d01b;hp=3822e3bc5f225ee276724c9e3347b4e5fb772f19;hpb=a188a047ab79a742e55f157f29e30299baafa7d0;p=stockfish diff --git a/src/position.h b/src/position.h index 3822e3bc..ceebce1c 100644 --- a/src/position.h +++ b/src/position.h @@ -215,7 +215,7 @@ public: template Bitboard piece_attacks_square(Square f, Square t) const; // Dispatch at compile-time - bool piece_attacks_square(Square f, Square t) const; // Dispatch at run-time + bool piece_attacks_square(Piece p, Square f, Square t) const; // Dispatch at run-time // Properties of moves bool pl_move_is_legal(Move m) const; @@ -529,12 +529,12 @@ inline Square Position::initial_qr_square(Color c) const { } inline Bitboard Position::pawn_attacks(Color c, Square s) const { - return StepAttackBB[pawn_of_color(c)][s]; + return StepAttackBB[piece_of_color_and_type(c, PAWN)][s]; } template<> inline Bitboard Position::piece_attacks(Square s) const { - return StepAttackBB[pawn_of_color(opposite_color(sideToMove))][s]; + return StepAttackBB[piece_of_color_and_type(opposite_color(sideToMove), PAWN)][s]; } template<> @@ -675,28 +675,28 @@ inline Phase Position::game_phase() const { inline bool Position::move_is_deep_pawn_push(Move m) const { Color c = side_to_move(); - return piece_on(move_from(m)) == pawn_of_color(c) + return piece_on(move_from(m)) == piece_of_color_and_type(c, PAWN) && relative_rank(c, move_to(m)) > RANK_4; } inline bool Position::move_is_pawn_push_to_7th(Move m) const { Color c = side_to_move(); - return piece_on(move_from(m)) == pawn_of_color(c) + return piece_on(move_from(m)) == piece_of_color_and_type(c, PAWN) && relative_rank(c, move_to(m)) == RANK_7; } inline bool Position::move_is_passed_pawn_push(Move m) const { Color c = side_to_move(); - return piece_on(move_from(m)) == pawn_of_color(c) + return piece_on(move_from(m)) == piece_of_color_and_type(c, PAWN) && pawn_is_passed(c, move_to(m)); } inline bool Position::move_was_passed_pawn_push(Move m) const { Color c = opposite_color(side_to_move()); - return piece_on(move_to(m)) == pawn_of_color(c) + return piece_on(move_to(m)) == piece_of_color_and_type(c, PAWN) && pawn_is_passed(c, move_to(m)); }