mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-17 23:56:23 +08:00
Use MoveList also in Position::move_is_pl_slow()
And rename it in Position::move_is_legal() No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -545,20 +545,14 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
|
||||
}
|
||||
|
||||
|
||||
/// Position::move_is_pl_slow() takes a move and tests whether the move
|
||||
/// is pseudo legal. This version is not very fast and should be used
|
||||
/// only in non time-critical paths.
|
||||
/// Position::move_is_legal() takes a move and tests whether the move
|
||||
/// is legal. This version is not very fast and should be used only
|
||||
/// in non time-critical paths.
|
||||
|
||||
bool Position::move_is_pl_slow(const Move m) const {
|
||||
bool Position::move_is_legal(const Move m) const {
|
||||
|
||||
MoveStack mlist[MAX_MOVES];
|
||||
MoveStack *cur, *last;
|
||||
|
||||
last = in_check() ? generate<MV_EVASION>(*this, mlist)
|
||||
: generate<MV_NON_EVASION>(*this, mlist);
|
||||
|
||||
for (cur = mlist; cur != last; cur++)
|
||||
if (cur->move == m)
|
||||
for (MoveList<MV_LEGAL> ml(*this); !ml.end(); ++ml)
|
||||
if (ml.move() == m)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -580,7 +574,7 @@ bool Position::move_is_pl(const Move m) const {
|
||||
|
||||
// Use a slower but simpler function for uncommon cases
|
||||
if (move_is_special(m))
|
||||
return move_is_pl_slow(m);
|
||||
return move_is_legal(m);
|
||||
|
||||
// Is not a promotion, so promotion piece must be empty
|
||||
if (promotion_piece_type(m) - 2 != PIECE_TYPE_NONE)
|
||||
|
||||
Reference in New Issue
Block a user