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

Fix some comments in position.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-03-04 16:34:04 +01:00
parent 7c84b39a42
commit 7fe1632a49

View file

@ -1208,7 +1208,7 @@ void Position::undo_move(Move m) {
board[to] = EMPTY; board[to] = EMPTY;
} }
// Finally point out state pointer back to the previous state // Finally point our state pointer back to the previous state
st = st->previous; st = st->previous;
assert(is_ok()); assert(is_ok());
@ -1414,7 +1414,7 @@ void Position::undo_ep_move(Move m) {
/// Position::do_null_move makes() a "null move": It switches the side to move /// Position::do_null_move makes() a "null move": It switches the side to move
/// and updates the hash key without executing any move on the board. /// and updates the hash key without executing any move on the board.
void Position::do_null_move(StateInfo& newSt) { void Position::do_null_move(StateInfo& backupSt) {
assert(is_ok()); assert(is_ok());
assert(!is_check()); assert(!is_check());
@ -1422,10 +1422,12 @@ void Position::do_null_move(StateInfo& newSt) {
// Back up the information necessary to undo the null move to the supplied // Back up the information necessary to undo the null move to the supplied
// StateInfo object. In the case of a null move, the only thing we need to // StateInfo object. In the case of a null move, the only thing we need to
// remember is the last move made and the en passant square. // remember is the last move made and the en passant square.
newSt.lastMove = st->lastMove; // Note that differently from normal case here backupSt is actually used as
newSt.epSquare = st->epSquare; // a backup storage not as a new state to be used.
newSt.previous = st->previous; backupSt.lastMove = st->lastMove;
st->previous = &newSt; backupSt.epSquare = st->epSquare;
backupSt.previous = st->previous;
st->previous = &backupSt;
// Save the current key to the history[] array, in order to be able to // Save the current key to the history[] array, in order to be able to
// detect repetition draws. // detect repetition draws.
@ -1455,7 +1457,7 @@ void Position::undo_null_move() {
assert(is_ok()); assert(is_ok());
assert(!is_check()); assert(!is_check());
// Restore information from the our StateInfo object // Restore information from the our backup StateInfo object
st->lastMove = st->previous->lastMove; st->lastMove = st->previous->lastMove;
st->epSquare = st->previous->epSquare; st->epSquare = st->previous->epSquare;
st->previous = st->previous->previous; st->previous = st->previous->previous;