- // Pawn blocking evasions (possible only if the checking piece is a slider)
- if (sliderAttacks)
- mlist = generate_piece_evasions<PAWN>(pos, mlist, us, target, pinned);
-
- // Add the checking piece to the target squares
- target |= checkers;
-
- // Captures and blocking evasions for the other pieces
- mlist = generate_piece_evasions<KNIGHT>(pos, mlist, us, target, pinned);
- mlist = generate_piece_evasions<BISHOP>(pos, mlist, us, target, pinned);
- mlist = generate_piece_evasions<ROOK>(pos, mlist, us, target, pinned);
- mlist = generate_piece_evasions<QUEEN>(pos, mlist, us, target, pinned);
-
- // Finally, the special case of en passant captures. An en passant
- // capture can only be a check evasion if the check is not a discovered
- // check. If pos.ep_square() is set, the last move made must have been
- // a double pawn push. If, furthermore, the checking piece is a pawn,
- // an en passant check evasion may be possible.
- if (pos.ep_square() != SQ_NONE && (checkers & pos.pieces(PAWN, them)))
- {
- to = pos.ep_square();
- b1 = pos.attacks_from<PAWN>(to, them) & pos.pieces(PAWN, us);
+ if (Type == QUIET_CHECKS)
+ {
+ b1 &= pos.attacks_from<PAWN>(ci->ksq, Them);
+ b2 &= pos.attacks_from<PAWN>(ci->ksq, Them);
+
+ // Add pawn pushes which give discovered check. This is possible only
+ // if the pawn is not on the same file as the enemy king, because we
+ // don't generate captures. Note that a possible discovery check
+ // promotion has been already generated among captures.
+ if (pawnsNotOn7 & ci->dcCandidates)
+ {
+ dc1 = move_pawns<UP>(pawnsNotOn7 & ci->dcCandidates) & emptySquares & ~file_bb(ci->ksq);
+ dc2 = move_pawns<UP>(dc1 & TRank3BB) & emptySquares;