]> git.sesse.net Git - stockfish/blobdiff - src/move.cpp
Retire is_mate()
[stockfish] / src / move.cpp
index 7b8c4fcc62634e8eb086f867c3c6d0ee4d2a9fbf..1bf9b6a18b6556d727882d05894c19bab830f9b2 100644 (file)
@@ -147,13 +147,13 @@ const string move_to_san(Position& pos, Move m) {
       }
   }
 
-  // The move gives check? We don't use pos.move_gives_check() here
-  // because we need to test for a mate after the move is done.
-  StateInfo st;
-  pos.do_move(m, st);
-  if (pos.in_check())
-      san += pos.is_mate() ? "#" : "+";
-  pos.undo_move(m);
+  if (pos.move_gives_check(m, CheckInfo(pos)))
+  {
+      StateInfo st;
+      pos.do_move(m, st);
+      san += MoveList<MV_LEGAL>(pos).size() ? "+" : "#";
+      pos.undo_move(m);
+  }
 
   return san;
 }