]> git.sesse.net Git - stockfish/blobdiff - src/position.h
Introduce captured_piece()
[stockfish] / src / position.h
index a1d53f042c8cb111124746c0b68919bb6285ddb5..d92ed1caf4c4067f479407a31c6bc07ceba7206e 100644 (file)
@@ -146,9 +146,9 @@ public:
   };
 
   // Constructors
-  Position() {}
-  Position(const Position& pos);
-  Position(const std::string& fen);
+  Position();
+  explicit Position(const Position& pos);
+  explicit Position(const std::string& fen);
 
   // Text input/output
   void from_fen(const std::string& fen);
@@ -156,7 +156,7 @@ public:
   void print(Move m = MOVE_NONE) const;
 
   // Copying
-  void copy(const Position& pos);
+  void fast_copy(const Position& pos);
   void flipped_copy(const Position& pos);
 
   // The piece on a given square
@@ -224,6 +224,9 @@ public:
   bool move_is_passed_pawn_push(Move m) const;
   bool move_attacks_square(Move m, Square s) const;
 
+  // Piece captured with previous moves
+  PieceType captured_piece() const;
+
   // Information about pawns
   bool pawn_is_passed(Color c, Square s) const;
   static bool pawn_is_passed(Bitboard theirPawns, Color c, Square s);
@@ -234,7 +237,7 @@ public:
   bool square_is_weak(Square s, Color c) const;
 
   // Doing and undoing moves
-  void saveState();
+  void detach();
   void do_move(Move m, StateInfo& st);
   void do_move(Move m, StateInfo& st, const CheckInfo& ci, bool moveIsCheck);
   void undo_move(Move m);
@@ -567,4 +570,8 @@ inline bool Position::move_is_capture_or_promotion(Move m) const {
   return (m & (0x1F << 12)) ? !move_is_castle(m) : !square_is_empty(move_to(m));
 }
 
+inline PieceType Position::captured_piece() const {
+  return st->capture;
+}
+
 #endif // !defined(POSITION_H_INCLUDED)