]> git.sesse.net Git - stockfish/blobdiff - src/position.h
Move kingSquare[] array to StateInfo
[stockfish] / src / position.h
index 0006fbc772ca267e825d781c458e30ee28409c71..8e6fa93876ff1573364f6008b485c45794963293 100644 (file)
@@ -89,7 +89,7 @@ enum Phase {
 struct StateInfo {
   Key key, pawnKey, materialKey;
   int castleRights, rule50;
-  Square epSquare;
+  Square kingSquare[2], epSquare;
   Value mgValue, egValue;
   Value npMaterial[2];
 
@@ -326,7 +326,6 @@ private:
   int index[64]; // [square]
 
   // Other info
-  Square kingSquare[2];
   Color sideToMove;
   int gamePly;
   Key history[MaxGameLength];
@@ -423,7 +422,7 @@ inline Square Position::ep_square() const {
 }
 
 inline Square Position::king_square(Color c) const {
-  return kingSquare[c];
+  return st->kingSquare[c];
 }
 
 inline bool Position::can_castle_kingside(Color side) const {
@@ -457,7 +456,7 @@ inline Bitboard Position::piece_attacks(Square s) const {
 
 template<>
 inline Bitboard Position::piece_attacks<PAWN>(Square s) const {
-  return StepAttackBB[piece_of_color_and_type(opposite_color(sideToMove), PAWN)][s];
+  return StepAttackBB[WP][s] | StepAttackBB[BP][s];
 }
 
 template<>