X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fposition.h;h=527e66e8b623073764f43d7569b7f305d0f15945;hb=bbd69c0260a12cedf2b4d32b9ec3d478270533ce;hp=03aa97d83a6cec9fccae25ddac607fbce14c6030;hpb=7b0a2f2a90b63d9e5e092786fbfb54cd8ad3d8e5;p=stockfish diff --git a/src/position.h b/src/position.h index 03aa97d8..527e66e8 100644 --- a/src/position.h +++ b/src/position.h @@ -100,10 +100,10 @@ public: template 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 @@ -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;