X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=004d6994731ca106e0dd3d7afd6fb5f5b31fd719;hp=9f2ee1970c36e28db3c055361c2bd7bcf584f6a9;hb=c45a4e0b48d7f5c570637d63592a07e185476334;hpb=96d3b1c92b8db7d2238fc4993a4f3da49f04d614 diff --git a/src/position.cpp b/src/position.cpp index 9f2ee197..004d6994 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -657,7 +657,7 @@ bool Position::is_pseudo_legal(const Move m) const { /// Position::move_gives_check() tests whether a pseudo-legal move gives a check -CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const { +bool Position::move_gives_check(Move m, const CheckInfo& ci) const { assert(is_ok(m)); assert(ci.dcCandidates == discovered_check_candidates()); @@ -669,7 +669,7 @@ CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const { // Direct check ? if (ci.checkSq[pt] & to) - return DIRECT_CHECK; + return true; // Discovery check ? if (ci.dcCandidates && (ci.dcCandidates & from)) @@ -677,19 +677,19 @@ CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const { // For pawn and king moves we need to verify also direction if ( (pt != PAWN && pt != KING) || !squares_aligned(from, to, king_square(~sideToMove))) - return DISCO_CHECK; + return true; } // Can we skip the ugly special cases ? if (type_of(m) == NORMAL) - return NO_CHECK; + return false; Color us = sideToMove; Square ksq = king_square(~us); // Promotion with check ? if (type_of(m) == PROMOTION) - return attacks_from(Piece(promotion_type(m)), to, pieces() ^ from) & ksq ? DIRECT_CHECK : NO_CHECK; + return attacks_from(Piece(promotion_type(m)), to, pieces() ^ from) & ksq; // En passant capture with check ? We have already handled the case // of direct checks and ordinary discovered check, the only case we @@ -701,7 +701,7 @@ CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const { Bitboard b = (pieces() ^ from ^ capsq) | to; return (attacks_bb< ROOK>(ksq, b) & pieces(us, QUEEN, ROOK)) - | (attacks_bb(ksq, b) & pieces(us, QUEEN, BISHOP)) ? DISCO_CHECK : NO_CHECK; + | (attacks_bb(ksq, b) & pieces(us, QUEEN, BISHOP)); } // Castling with check ? @@ -713,10 +713,10 @@ CheckType Position::move_gives_check(Move m, const CheckInfo& ci) const { Square rto = relative_square(us, rfrom > kfrom ? SQ_F1 : SQ_D1); Bitboard b = (pieces() ^ kfrom ^ rfrom) | rto | kto; - return attacks_bb(rto, b) & ksq ? DIRECT_CHECK : NO_CHECK; + return attacks_bb(rto, b) & ksq; } - return NO_CHECK; + return false; }