]> git.sesse.net Git - stockfish/blobdiff - src/position.h
Fix dbg_mean_of() for negative numbers
[stockfish] / src / position.h
index 03aa97d83a6cec9fccae25ddac607fbce14c6030..527e66e8b623073764f43d7569b7f305d0f15945 100644 (file)
@@ -100,10 +100,10 @@ public:
   template<PieceType Pt> const Square* list(Color c) const;
 
   // Castling
-  int can_castle(CastlingFlag f) const;
   int can_castle(Color c) const;
-  bool castling_impeded(Color c, CastlingSide s) const;
-  Square castling_rook_square(Color c, CastlingSide s) const;
+  int can_castle(CastlingFlag f) const;
+  bool castling_impeded(CastlingFlag f) const;
+  Square castling_rook_square(CastlingFlag f) const;
 
   // Checking
   Bitboard checkers() const;
@@ -198,15 +198,15 @@ private:
 
   // Other info
   int castlingFlagsMask[SQUARE_NB];
-  Square castlingRookSquare[COLOR_NB][CASTLING_SIDE_NB];
-  Bitboard castlingPath[COLOR_NB][CASTLING_SIDE_NB];
+  Square castlingRookSquare[CASTLING_FLAG_NB];
+  Bitboard castlingPath[CASTLING_FLAG_NB];
   StateInfo startState;
   uint64_t nodes;
   int gamePly;
   Color sideToMove;
   Thread* thisThread;
   StateInfo* st;
-  int chess960;
+  bool chess960;
 };
 
 inline uint64_t Position::nodes_searched() const {
@@ -281,12 +281,12 @@ inline int Position::can_castle(Color c) const {
   return st->castlingFlags & ((WHITE_OO | WHITE_OOO) << (2 * c));
 }
 
-inline bool Position::castling_impeded(Color c, CastlingSide s) const {
-  return byTypeBB[ALL_PIECES] & castlingPath[c][s];
+inline bool Position::castling_impeded(CastlingFlag f) const {
+  return byTypeBB[ALL_PIECES] & castlingPath[f];
 }
 
-inline Square Position::castling_rook_square(Color c, CastlingSide s) const {
-  return castlingRookSquare[c][s];
+inline Square Position::castling_rook_square(CastlingFlag f) const {
+  return castlingRookSquare[f];
 }
 
 template<PieceType Pt>
@@ -403,7 +403,6 @@ inline void Position::put_piece(Square s, Color c, PieceType pt) {
   byTypeBB[ALL_PIECES] |= s;
   byTypeBB[pt] |= s;
   byColorBB[c] |= s;
-  pieceCount[c][ALL_PIECES]++;
   index[s] = pieceCount[c][pt]++;
   pieceList[c][pt][index[s]] = s;
 }
@@ -432,7 +431,6 @@ inline void Position::remove_piece(Square s, Color c, PieceType pt) {
   byTypeBB[pt] ^= s;
   byColorBB[c] ^= s;
   /* board[s] = NO_PIECE; */ // Not needed, will be overwritten by capturing
-  pieceCount[c][ALL_PIECES]--;
   Square lastSquare = pieceList[c][pt][--pieceCount[c][pt]];
   index[lastSquare] = index[s];
   pieceList[c][pt][index[lastSquare]] = lastSquare;