From dc2302b701083dade07d59b1ffbfd180d47c4383 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Fri, 5 Dec 2008 12:38:20 +0100 Subject: [PATCH 1/1] Position::move_is_capture() does not handle MOVE_NONE Actually square 0 can be dirty, so that move_is_capture(0) can return any random values. Add an assert to be sure it is caught. Signed-off-by: Marco Costalba --- src/position.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/position.cpp b/src/position.cpp index dceaa5a4..98e79df2 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -675,10 +675,12 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const { /// Position::move_is_capture() tests whether a move from the current -/// position is a capture. +/// position is a capture. Move must not be MOVE_NONE. bool Position::move_is_capture(Move m) const { + assert(m != MOVE_NONE); + return ( !square_is_empty(move_to(m)) && (color_of_piece_on(move_to(m)) == opposite_color(side_to_move())) ) -- 2.39.2