X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=c974f1bd97a50e2c081b549d3210d791d00c9dbe;hp=d6efe7114d444fd006de63f4204cdebdc4c66b4d;hb=13b4444d9e3a3ac5a71f256145904d13754f9e7f;hpb=805afcbf3d5db39c85b759232cfb99ab0a250311 diff --git a/src/position.h b/src/position.h index d6efe711..c974f1bd 100644 --- a/src/position.h +++ b/src/position.h @@ -42,16 +42,6 @@ namespace PSQT { } -/// CheckInfo struct keeps info used to detect if a move gives check - -struct CheckInfo { - - Bitboard blockersForKing[COLOR_NB]; - Bitboard checkSquares[PIECE_TYPE_NB]; - Square ksq; -}; - - /// StateInfo struct stores information needed to restore a Position object to /// its previous state when we retract a move. Whenever a move is made on the /// board (by calling Position::do_move), a StateInfo object must be passed. @@ -73,7 +63,8 @@ struct StateInfo { Bitboard checkersBB; PieceType capturedType; StateInfo* previous; - CheckInfo ci; + Bitboard blockersForKing[COLOR_NB]; + Bitboard checkSquares[PIECE_TYPE_NB]; }; // In a std::deque references to elements are unaffected upon resizing @@ -122,7 +113,7 @@ public: Bitboard checkers() const; Bitboard discovered_check_candidates() const; Bitboard pinned_pieces(Color c) const; - const CheckInfo& check_info() const; + Bitboard check_squares(PieceType pt) const; // Attacks to/from a given square Bitboard attackers_to(Square s) const; @@ -159,7 +150,6 @@ public: // Accessing hash keys Key key() const; Key key_after(Move m) const; - Key exclusion_key() const; Key material_key() const; Key pawn_key() const; @@ -184,7 +174,7 @@ private: // Initialization helpers (used while setting up a position) void set_castling_right(Color c, Square rfrom); void set_state(StateInfo* si) const; - void set_check_info(CheckInfo* ci) const; + void set_check_info(StateInfo* si) const; // Other helpers void put_piece(Color c, PieceType pt, Square s); @@ -311,15 +301,15 @@ inline Bitboard Position::checkers() const { } inline Bitboard Position::discovered_check_candidates() const { - return st->ci.blockersForKing[~sideToMove] & pieces(sideToMove); + return st->blockersForKing[~sideToMove] & pieces(sideToMove); } inline Bitboard Position::pinned_pieces(Color c) const { - return st->ci.blockersForKing[c] & pieces(c); + return st->blockersForKing[c] & pieces(c); } -inline const CheckInfo& Position::check_info() const { - return st->ci; +inline Bitboard Position::check_squares(PieceType pt) const { + return st->checkSquares[pt]; } inline bool Position::pawn_passed(Color c, Square s) const {