X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovegen.cpp;h=b3a25806aaa5593ae064ca5d816735e4806dc628;hp=0f2f6b4e0fd37d94187eeb05cfde1d6179e1b412;hb=7c267587fc7f454182b4d527607bcf8fdbd8c41c;hpb=e7f03913eaa10454850f79f2e54826af7d9ebb70 diff --git a/src/movegen.cpp b/src/movegen.cpp index 0f2f6b4e..b3a25806 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -73,9 +73,8 @@ namespace { return Us == WHITE ? p << 9 : p >> 7; else if (Direction == DELTA_NW) return Us == WHITE ? p << 7 : p >> 9; - - assert(false); - return p; + else + return p; } // Template generate_piece_checks() with specializations @@ -177,10 +176,10 @@ int generate_noncaptures(const Position& pos, MoveStack* mlist) { } -/// generate_checks() generates all pseudo-legal non-capturing, non-promoting -/// checks. It returns the number of generated moves. +/// generate_non_capture_checks() generates all pseudo-legal non-capturing, +/// non-promoting checks. It returns the number of generated moves. -int generate_checks(const Position& pos, MoveStack* mlist, Bitboard dc) { +int generate_non_capture_checks(const Position& pos, MoveStack* mlist, Bitboard dc) { assert(pos.is_ok()); assert(!pos.is_check()); @@ -815,9 +814,17 @@ namespace { return mlist; Bitboard checkSqs = pos.piece_attacks(ksq) & pos.empty_squares(); + if (!checkSqs) + return mlist; + while (b) { Square from = pop_1st_bit(&b); + if ( (Piece == QUEEN && !(QueenPseudoAttacks[from] & checkSqs)) + || (Piece == ROOK && !(RookPseudoAttacks[from] & checkSqs)) + || (Piece == BISHOP && !(BishopPseudoAttacks[from] & checkSqs))) + continue; + Bitboard bb = pos.piece_attacks(from) & checkSqs; SERIALIZE_MOVES(bb); }