return false;
// The destination square cannot be occupied by a friendly piece
- if (color_of(piece_on(to)) == us)
+ if (piece_on(to) != NO_PIECE && color_of(piece_on(to)) == us)
return false;
// Handle the special case of a pawn move
case DELTA_SE:
// Capture. The destination square must be occupied by an enemy
// piece (en passant captures was handled earlier).
- if (color_of(piece_on(to)) != them)
+ if (piece_on(to) == NO_PIECE || color_of(piece_on(to)) != them)
return false;
// From and to files must be one file apart, avoids a7h5
PieceType capture = type_of(m) == ENPASSANT ? PAWN : type_of(piece_on(to));
assert(color_of(piece) == us);
- assert(color_of(piece_on(to)) != us);
+ assert(piece_on(to) == NO_PIECE || color_of(piece_on(to)) == them);
assert(capture != KING);
if (capture)
}
// Prefetch pawn and material hash tables
- prefetch((char*)thisThread->pawnTable.entries[st->pawnKey]);
- prefetch((char*)thisThread->materialTable.entries[st->materialKey]);
+ prefetch((char*)thisThread->pawnsTable[st->pawnKey]);
+ prefetch((char*)thisThread->materialTable[st->materialKey]);
// Update incremental scores
st->psqScore += psq_delta(piece, from, to);