- // Test discovered check and normal check according to piece type
- case KNIGHT:
- return (dcCandidates && bit_is_set(dcCandidates, from))
- || bit_is_set(piece_attacks<KNIGHT>(ksq), to);
-
- case BISHOP:
- return (dcCandidates && bit_is_set(dcCandidates, from))
- || (direction_is_diagonal(ksq, to) && bit_is_set(piece_attacks<BISHOP>(ksq), to));
-
- case ROOK:
- return (dcCandidates && bit_is_set(dcCandidates, from))
- || (direction_is_straight(ksq, to) && bit_is_set(piece_attacks<ROOK>(ksq), to));
-
- case QUEEN:
- // Discovered checks are impossible!
- assert(!bit_is_set(dcCandidates, from));
- return ( (direction_is_straight(ksq, to) && bit_is_set(piece_attacks<ROOK>(ksq), to))
- || (direction_is_diagonal(ksq, to) && bit_is_set(piece_attacks<BISHOP>(ksq), to)));
-
- case KING:
- // Discovered check?
- if ( bit_is_set(dcCandidates, from)
- && (direction_between_squares(from, ksq) != direction_between_squares(to, ksq)))
- return true;