diff --git a/src/position.h b/src/position.h index 27becfed0..96ccb3258 100644 --- a/src/position.h +++ b/src/position.h @@ -346,7 +346,13 @@ inline bool Position::is_chess960() const { return chess960; } inline bool Position::capture(Move m) const { assert(m.is_ok()); - return (!empty(m.to_sq()) && m.type_of() != CASTLING) || m.type_of() == EN_PASSANT; + + const MoveType mt = m.type_of(); + + if (mt == NORMAL || mt == PROMOTION) + return !empty(m.to_sq()); + + return mt == EN_PASSANT; } // Returns true if a move is generated from the capture stage, having also @@ -354,7 +360,16 @@ inline bool Position::capture(Move m) const { // generation is needed to avoid the generation of duplicate moves. inline bool Position::capture_stage(Move m) const { assert(m.is_ok()); - return capture(m) || m.promotion_type() == QUEEN; + + const MoveType mt = m.type_of(); + + if (mt == NORMAL) + return !empty(m.to_sq()); + + if (mt == PROMOTION) + return !empty(m.to_sq()) || m.promotion_type() == QUEEN; + + return mt == EN_PASSANT; } inline Piece Position::captured_piece() const { return st->capturedPiece; }