]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Fix a subtle bug in Position::move_is_capture()
[stockfish] / src / position.cpp
index 31176c9d42ead1a504a57c426b1b40c748a7f6c1..a6f70c082cc99cb01d5b970047ab462959af117e 100644 (file)
@@ -118,7 +118,7 @@ void Position::from_fen(const std::string& fen) {
   }
   sideToMove = (fen[i] == 'w' ? WHITE : BLACK);
 
-  // Castling rights:
+  // Castling rights
   i++;
   if (fen[i] != ' ')
   {
@@ -665,7 +665,7 @@ 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()))
+          && (color_of_piece_on(move_to(m)) != color_of_piece_on(move_from(m)))
          )
          || move_is_ep(m);
 }