X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;fp=src%2Fposition.cpp;h=ec356ace9b01494ae6a81801fda383d191b81cdd;hp=6c5a11b2595dad24ccbdcaa27f615cd749d424fb;hb=c489df6f5b5629a135af3b8222fa1ef607ec1526;hpb=62a0b65ff886f8f4895d854705c0c870e6a2a834 diff --git a/src/position.cpp b/src/position.cpp index 6c5a11b2..ec356ace 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -544,7 +544,7 @@ bool Position::legal(Move m) const { // If the moving piece is a king, check whether the destination square is // attacked by the opponent. if (type_of(piece_on(from)) == KING) - return !(attackers_to(to) & pieces(~us)); + return !(attackers_to(to, pieces() ^ from) & pieces(~us)); // A non-king move is legal if and only if it is not pinned or it // is moving along the ray towards or away from the king.