]> git.sesse.net Git - stockfish/commitdiff
Position::move_is_capture() does not handle MOVE_NONE
authorMarco Costalba <mcostalba@gmail.com>
Fri, 5 Dec 2008 11:38:20 +0000 (12:38 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 6 Dec 2008 10:18:31 +0000 (11:18 +0100)
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 <mcostalba@gmail.com>
src/position.cpp

index dceaa5a4bc331d2240f98269c7e037f524888826..98e79df2a82d2d661c9af66aa8d8004466da1bab 100644 (file)
@@ -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::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 {
 
 
 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()))
          )
   return (   !square_is_empty(move_to(m))
           && (color_of_piece_on(move_to(m)) == opposite_color(side_to_move()))
          )