mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Fix a bug in generate_piece_checks()
We are generating also king moves that give check ! Of course these moves are illegal so are in any case filtered out in MovePicker. Neverthless we should avoid to generate them. Also simplify a bit the code. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -848,10 +848,8 @@ namespace {
|
|||||||
|
|
||||||
// Direct checks
|
// Direct checks
|
||||||
b = target & ~dc;
|
b = target & ~dc;
|
||||||
if (Piece != KING || b)
|
|
||||||
{
|
|
||||||
Bitboard checkSqs = pos.attacks_from<Piece>(ksq) & pos.empty_squares();
|
Bitboard checkSqs = pos.attacks_from<Piece>(ksq) & pos.empty_squares();
|
||||||
if (!checkSqs)
|
if (Piece == KING || !checkSqs)
|
||||||
return mlist;
|
return mlist;
|
||||||
|
|
||||||
while (b)
|
while (b)
|
||||||
@@ -865,7 +863,6 @@ namespace {
|
|||||||
Bitboard bb = pos.attacks_from<Piece>(from) & checkSqs;
|
Bitboard bb = pos.attacks_from<Piece>(from) & checkSqs;
|
||||||
SERIALIZE_MOVES(bb);
|
SERIALIZE_MOVES(bb);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return mlist;
|
return mlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user