1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Retire kingSquare[] array

It is redundant. Use pieceList[c][KING][0] instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-09-23 17:47:03 +01:00
parent 44cb792c76
commit dcb323bf0d
2 changed files with 3 additions and 13 deletions

View file

@ -704,7 +704,7 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
struct ReducedStateInfo { struct ReducedStateInfo {
Key key, pawnKey, materialKey; Key key, pawnKey, materialKey;
int castleRights, rule50; int castleRights, rule50;
Square kingSquare[2], epSquare; Square epSquare;
Value mgValue, egValue; Value mgValue, egValue;
Value npMaterial[2]; Value npMaterial[2];
}; };
@ -784,10 +784,6 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
board[to] = board[from]; board[to] = board[from];
board[from] = EMPTY; board[from] = EMPTY;
// If the moving piece was a king, update the king square
if (pt == KING)
st->kingSquare[us] = to;
// Update piece lists, note that index[from] is not updated and // Update piece lists, note that index[from] is not updated and
// becomes stale. This works as long as index[] is accessed just // becomes stale. This works as long as index[] is accessed just
// by known occupied squares. // by known occupied squares.
@ -1005,9 +1001,6 @@ void Position::do_castle_move(Move m) {
board[kto] = king; board[kto] = king;
board[rto] = rook; board[rto] = rook;
// Update king square
st->kingSquare[us] = kto;
// Update piece lists // Update piece lists
pieceList[us][KING][index[kfrom]] = kto; pieceList[us][KING][index[kfrom]] = kto;
pieceList[us][ROOK][index[rfrom]] = rto; pieceList[us][ROOK][index[rfrom]] = rto;
@ -1519,9 +1512,6 @@ void Position::put_piece(Piece p, Square s) {
set_bit(&byTypeBB[0], s); // HACK: byTypeBB[0] contains all occupied squares. set_bit(&byTypeBB[0], s); // HACK: byTypeBB[0] contains all occupied squares.
pieceCount[c][pt]++; pieceCount[c][pt]++;
if (pt == KING)
st->kingSquare[c] = s;
} }

View file

@ -89,7 +89,7 @@ enum Phase {
struct StateInfo { struct StateInfo {
Key key, pawnKey, materialKey; Key key, pawnKey, materialKey;
int castleRights, rule50; int castleRights, rule50;
Square kingSquare[2], epSquare; Square epSquare;
Value mgValue, egValue; Value mgValue, egValue;
Value npMaterial[2]; Value npMaterial[2];
@ -408,7 +408,7 @@ inline Square Position::ep_square() const {
} }
inline Square Position::king_square(Color c) const { 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 { inline bool Position::can_castle_kingside(Color side) const {