]> git.sesse.net Git - stockfish/blobdiff - src/position.h
Cleanup piece_attacks_square() functions
[stockfish] / src / position.h
index 1505874e9f0269111f338fd5d09f0a2efca95b7b..d47d84b7633c40924e38439e4b41a4fb0dd54ba6 100644 (file)
@@ -196,15 +196,11 @@ public:
   Square piece_list(Color c, PieceType pt, int index) const;
 
   // Attack information to a given square
-  Bitboard attacks_to(Square s) const;
-  Bitboard attacks_to(Square s, Color c) const;
-  template<PieceType> Bitboard piece_attacks(Square s) const;
+  Bitboard attackers_to(Square s) const;
+  Bitboard attackers_to(Square s, Color c) const;
+  Bitboard piece_attacks(Piece p, Square s) const;
   Bitboard pawn_attacks(Square s, Color c) const;
-
-  // Attack information to a given square from another given square
-  template<PieceType> Bitboard piece_attacks_square(Square f, Square t) const; // Dispatch at compile-time
-  bool piece_attacks_square(Piece p, Square f, Square t) const; // Dispatch at run-time
-  bool pawn_attacks_square(Square f, Square t, Color c) const;
+  template<PieceType> Bitboard piece_attacks(Square s) const;
 
   // Properties of moves
   bool pl_move_is_legal(Move m) const;
@@ -474,18 +470,9 @@ inline bool Position::is_check() const {
   return st->checkersBB != EmptyBoardBB;
 }
 
-inline bool Position::pawn_attacks_square(Square f, Square t, Color c) const {
-  return bit_is_set(pawn_attacks(f, c), t);
-}
-
-template<PieceType Piece>
-inline Bitboard Position::piece_attacks_square(Square f, Square t) const {
-  return bit_is_set(piece_attacks<Piece>(f), t);
-}
-
-inline Bitboard Position::attacks_to(Square s, Color c) const {
+inline Bitboard Position::attackers_to(Square s, Color c) const {
 
-  return attacks_to(s) & pieces_of_color(c);
+  return attackers_to(s) & pieces_of_color(c);
 }
 
 inline bool Position::pawn_is_passed(Color c, Square s) const {