]> git.sesse.net Git - stockfish/blobdiff - src/position.h
Update piece list iteration also in evaluate_pieces()
[stockfish] / src / position.h
index a051ec382f49fe15a0d3ee55238e97a48c1158ac..370bb1d45e0476a9618c42725e350b7dc0e018e2 100644 (file)
@@ -89,7 +89,7 @@ enum Phase {
 struct StateInfo {
   Key key, pawnKey, materialKey;
   int castleRights, rule50;
-  Square kingSquare[2], epSquare;
+  Square epSquare;
   Value mgValue, egValue;
   Value npMaterial[2];
 
@@ -193,6 +193,7 @@ public:
 
   // Piece lists
   Square piece_list(Color c, PieceType pt, int index) const;
+  const Square* piece_list_begin(Color c, PieceType pt) const;
 
   // Information about attacks to or from a given square
   Bitboard attackers_to(Square s) const;
@@ -298,12 +299,12 @@ private:
   template<GamePhase> Value compute_value() const;
   Value compute_non_pawn_material(Color c) const;
 
-  // Bitboards
-  Bitboard byColorBB[2], byTypeBB[8];
-
   // Board
   Piece board[64];
 
+  // Bitboards
+  Bitboard byTypeBB[8], byColorBB[2];
+
   // Piece counts
   int pieceCount[2][8]; // [color][pieceType]
 
@@ -403,12 +404,16 @@ inline Square Position::piece_list(Color c, PieceType pt, int index) const {
   return pieceList[c][pt][index];
 }
 
+inline const Square* Position::piece_list_begin(Color c, PieceType pt) const {
+  return pieceList[c][pt];
+}
+
 inline Square Position::ep_square() const {
   return st->epSquare;
 }
 
 inline Square Position::king_square(Color c) const {
-  return st->kingSquare[c];
+  return pieceList[c][KING][0];
 }
 
 inline bool Position::can_castle_kingside(Color side) const {