X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=1351d0d125a6b60a4d14d78aaf071af638417b92;hp=74173d03bc9004f75243177a45def93a57b81ade;hb=eb07775583c39893bc6eb65a40b5f62a7799deee;hpb=3c576efa77f431cf3687881b8fd6a728e87ed97d diff --git a/src/position.h b/src/position.h index 74173d03..1351d0d1 100644 --- a/src/position.h +++ b/src/position.h @@ -95,6 +95,7 @@ public: template int count() const; template const Square* squares(Color c) const; template Square square(Color c) const; + int semiopen_file(Color c, File f) const; // Castling int castling_rights(Color c) const; @@ -260,6 +261,10 @@ inline Square Position::ep_square() const { return st->epSquare; } +inline int Position::semiopen_file(Color c, File f) const { + return !(pieces(c, PAWN) & file_bb(f)); +} + inline bool Position::can_castle(CastlingRight cr) const { return st->castlingRights & cr; } @@ -310,7 +315,7 @@ inline Bitboard Position::check_squares(PieceType pt) const { } inline bool Position::pawn_passed(Color c, Square s) const { - return !(pieces(~c, PAWN) & passed_pawn_mask(c, s)); + return !(pieces(~c, PAWN) & passed_pawn_span(c, s)); } inline bool Position::advanced_pawn_push(Move m) const { @@ -413,7 +418,7 @@ inline void Position::move_piece(Piece pc, Square from, Square to) { // index[from] is not updated and becomes stale. This works as long as index[] // is accessed just by known occupied squares. - Bitboard fromTo = SquareBB[from] ^ SquareBB[to]; + Bitboard fromTo = square_bb(from) | square_bb(to); byTypeBB[ALL_PIECES] ^= fromTo; byTypeBB[type_of(pc)] ^= fromTo; byColorBB[color_of(pc)] ^= fromTo;