]> git.sesse.net Git - stockfish/blobdiff - src/position.h
Rename castling flag to castling right
[stockfish] / src / position.h
index 527e66e8b623073764f43d7569b7f305d0f15945..baf49705db7a6e00034a9ed9f561f267fda9b9cc 100644 (file)
@@ -51,7 +51,7 @@ struct CheckInfo {
 struct StateInfo {
   Key pawnKey, materialKey;
   Value npMaterial[COLOR_NB];
-  int castlingFlags, rule50, pliesFromNull;
+  int castlingRights, rule50, pliesFromNull;
   Score psq;
   Square epSquare;
 
@@ -101,9 +101,9 @@ public:
 
   // Castling
   int can_castle(Color c) const;
-  int can_castle(CastlingFlag f) const;
-  bool castling_impeded(CastlingFlag f) const;
-  Square castling_rook_square(CastlingFlag f) const;
+  int can_castle(CastlingRight cr) const;
+  bool castling_impeded(CastlingRight cr) const;
+  Square castling_rook_square(CastlingRight cr) const;
 
   // Checking
   Bitboard checkers() const;
@@ -170,7 +170,7 @@ public:
 private:
   // Initialization helpers (used while setting up a position)
   void clear();
-  void set_castling_flag(Color c, Square rfrom);
+  void set_castling_right(Color c, Square rfrom);
 
   // Helper functions
   void do_castling(Square kfrom, Square kto, Square rfrom, Square rto);
@@ -197,9 +197,9 @@ private:
   int index[SQUARE_NB];
 
   // Other info
-  int castlingFlagsMask[SQUARE_NB];
-  Square castlingRookSquare[CASTLING_FLAG_NB];
-  Bitboard castlingPath[CASTLING_FLAG_NB];
+  int castlingRightsMask[SQUARE_NB];
+  Square castlingRookSquare[CASTLING_RIGHT_NB];
+  Bitboard castlingPath[CASTLING_RIGHT_NB];
   StateInfo startState;
   uint64_t nodes;
   int gamePly;
@@ -273,20 +273,20 @@ inline Square Position::king_square(Color c) const {
   return pieceList[c][KING][0];
 }
 
-inline int Position::can_castle(CastlingFlag f) const {
-  return st->castlingFlags & f;
+inline int Position::can_castle(CastlingRight cr) const {
+  return st->castlingRights & cr;
 }
 
 inline int Position::can_castle(Color c) const {
-  return st->castlingFlags & ((WHITE_OO | WHITE_OOO) << (2 * c));
+  return st->castlingRights & ((WHITE_OO | WHITE_OOO) << (2 * c));
 }
 
-inline bool Position::castling_impeded(CastlingFlag f) const {
-  return byTypeBB[ALL_PIECES] & castlingPath[f];
+inline bool Position::castling_impeded(CastlingRight cr) const {
+  return byTypeBB[ALL_PIECES] & castlingPath[cr];
 }
 
-inline Square Position::castling_rook_square(CastlingFlag f) const {
-  return castlingRookSquare[f];
+inline Square Position::castling_rook_square(CastlingRight cr) const {
+  return castlingRookSquare[cr];
 }
 
 template<PieceType Pt>