X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fnotation.cpp;h=3f2499edccbdc7277c1ab21b8c87d7cb009886ad;hp=3ca43deb402515b61a893389bdccc96204ffe684;hb=698b645e10388366ca0400bc05c21af98b7703b2;hpb=3d8c0f16c237b1fddaec75c5db70545da47e8bcc diff --git a/src/notation.cpp b/src/notation.cpp index 3ca43deb..3f2499ed 100644 --- a/src/notation.cpp +++ b/src/notation.cpp @@ -70,7 +70,7 @@ const string move_to_uci(Move m, bool chess960) { return "0000"; if (type_of(m) == CASTLING && !chess960) - to = (to > from ? FILE_G : FILE_C) | rank_of(from); + to = make_square(to > from ? FILE_G : FILE_C, rank_of(from)); string move = to_string(from) + to_string(to); @@ -132,22 +132,22 @@ const string move_to_san(Position& pos, Move m) { while (b) { - Move move = make_move(pop_lsb(&b), to); - if (!pos.legal(move, pos.pinned_pieces(pos.side_to_move()))) - others ^= from_sq(move); + Square sq = pop_lsb(&b); + if (!pos.legal(make_move(sq, to), pos.pinned_pieces(us))) + others ^= sq; } - if (others) - { - if (!(others & file_bb(from))) - san += to_char(file_of(from)); + if (!others) + { /* disambiguation is not needed */ } - else if (!(others & rank_bb(from))) - san += to_char(rank_of(from)); + else if (!(others & file_bb(from))) + san += to_char(file_of(from)); - else - san += to_string(from); - } + else if (!(others & rank_bb(from))) + san += to_char(rank_of(from)); + + else + san += to_string(from); } else if (pos.capture(m)) san = to_char(file_of(from));