X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=004d6994731ca106e0dd3d7afd6fb5f5b31fd719;hp=be9e7ac847f68eac2e2bb339eaa84adb715f949a;hb=e3b03278129e4d7f130826aef209668b3268aa94;hpb=13f90a30ef4da98722c7167cfb98532fd56a84d6 diff --git a/src/position.cpp b/src/position.cpp index be9e7ac8..004d6994 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -473,37 +473,6 @@ Bitboard Position::attacks_from(Piece p, Square s, Bitboard occ) { } -/// Position::move_attacks_square() tests whether a move from the current -/// position attacks a given square. - -bool Position::move_attacks_square(Move m, Square s) const { - - assert(is_ok(m)); - assert(is_ok(s)); - - Bitboard occ, xray; - Square from = from_sq(m); - Square to = to_sq(m); - Piece piece = piece_moved(m); - - assert(!is_empty(from)); - - // Update occupancy as if the piece is moving - occ = pieces() ^ from ^ to; - - // The piece moved in 'to' attacks the square 's' ? - if (attacks_from(piece, to, occ) & s) - return true; - - // Scan for possible X-ray attackers behind the moved piece - xray = (attacks_bb< ROOK>(s, occ) & pieces(color_of(piece), QUEEN, ROOK)) - | (attacks_bb(s, occ) & pieces(color_of(piece), QUEEN, BISHOP)); - - // Verify attackers are triggered by our move and not already existing - return xray && (xray ^ (xray & attacks_from(s))); -} - - /// Position::pl_move_is_legal() tests whether a pseudo-legal move is legal bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { @@ -1479,13 +1448,13 @@ bool Position::is_draw() const { if (CheckRepetition) { - int i = 4, e = std::min(st->rule50, st->pliesFromNull); + int i = 4, e = std::min(st->rule50, st->pliesFromNull), cnt; if (i <= e) { StateInfo* stp = st->previous->previous; - for (int cnt = 0; i <= e; i += 2) + for (cnt = 0; i <= e; i += 2) { stp = stp->previous->previous;