X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=66890a5f5e2224473d81f4a20d6ab3b8b0937814;hb=939b621e5c67e9ef89b409fd773d38058341906c;hp=0f6a3febeb98d92a8e50232fcb16df4e1bd98716;hpb=5c8af7ccb8f59f901740d5a8f4a9270f69487583;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index 0f6a3feb..66890a5f 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -89,7 +89,7 @@ CheckInfo::CheckInfo(const Position& pos) { checkSq[BISHOP] = pos.attacks_from(ksq); checkSq[ROOK] = pos.attacks_from(ksq); checkSq[QUEEN] = checkSq[BISHOP] | checkSq[ROOK]; - checkSq[KING] = EmptyBoardBB; + checkSq[KING] = 0; } @@ -97,9 +97,11 @@ CheckInfo::CheckInfo(const Position& pos) { /// or the FEN string, we want the new born Position object do not depend /// on any external data so we detach state pointer from the source one. -Position::Position(const Position& pos, int th) { +void Position::copy(const Position& pos, int th) { memcpy(this, &pos, sizeof(Position)); + startState = *st; + st = &startState; threadID = th; nodes = 0; @@ -931,7 +933,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI st->key = key; // Update checkers bitboard, piece must be already moved - st->checkersBB = EmptyBoardBB; + st->checkersBB = 0; if (moveIsCheck) { @@ -1697,7 +1699,7 @@ bool Position::pos_is_ok(int* failedStep) const { if (debugBitboards) { // The intersection of the white and black pieces must be empty - if ((pieces(WHITE) & pieces(BLACK)) != EmptyBoardBB) + if (!(pieces(WHITE) & pieces(BLACK))) return false; // The union of the white and black pieces must be equal to all