mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Rename piece_attacks_from() in attacks_from()
It is in line with attackers_to() and is shorter and piece is already redundant because is passed as template parameter anyway. Integrate also pawn_attacks_from() in the attacks_from() family so to have an uniform attack info API. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -196,9 +196,9 @@ public:
|
||||
|
||||
// Information about attacks to or from a given square
|
||||
Bitboard attackers_to(Square s) const;
|
||||
Bitboard piece_attacks_from(Piece p, Square s) const;
|
||||
Bitboard pawn_attacks_from(Square s, Color c) const;
|
||||
template<PieceType> Bitboard piece_attacks_from(Square s) const;
|
||||
Bitboard attacks_from(Piece p, Square s) const;
|
||||
template<PieceType> Bitboard attacks_from(Square s) const;
|
||||
template<PieceType> Bitboard attacks_from(Square s, Color c) const;
|
||||
|
||||
// Properties of moves
|
||||
bool pl_move_is_legal(Move m) const;
|
||||
@@ -431,33 +431,29 @@ inline Square Position::initial_qr_square(Color c) const {
|
||||
return relative_square(c, make_square(initialQRFile, RANK_1));
|
||||
}
|
||||
|
||||
inline Bitboard Position::pawn_attacks_from(Square s, Color c) const {
|
||||
template<>
|
||||
inline Bitboard Position::attacks_from<PAWN>(Square s, Color c) const {
|
||||
return StepAttackBB[piece_of_color_and_type(c, PAWN)][s];
|
||||
}
|
||||
|
||||
template<PieceType Piece> // Knight and King
|
||||
inline Bitboard Position::piece_attacks_from(Square s) const {
|
||||
template<PieceType Piece> // Knight and King and white pawns
|
||||
inline Bitboard Position::attacks_from(Square s) const {
|
||||
return StepAttackBB[Piece][s];
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Bitboard Position::piece_attacks_from<PAWN>(Square s) const {
|
||||
return StepAttackBB[WP][s] | StepAttackBB[BP][s];
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Bitboard Position::piece_attacks_from<BISHOP>(Square s) const {
|
||||
inline Bitboard Position::attacks_from<BISHOP>(Square s) const {
|
||||
return bishop_attacks_bb(s, occupied_squares());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Bitboard Position::piece_attacks_from<ROOK>(Square s) const {
|
||||
inline Bitboard Position::attacks_from<ROOK>(Square s) const {
|
||||
return rook_attacks_bb(s, occupied_squares());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Bitboard Position::piece_attacks_from<QUEEN>(Square s) const {
|
||||
return piece_attacks_from<ROOK>(s) | piece_attacks_from<BISHOP>(s);
|
||||
inline Bitboard Position::attacks_from<QUEEN>(Square s) const {
|
||||
return attacks_from<ROOK>(s) | attacks_from<BISHOP>(s);
|
||||
}
|
||||
|
||||
inline Bitboard Position::checkers() const {
|
||||
|
||||
Reference in New Issue
Block a user