Clean up API for attack information

Remove undefined functions sliding_attacks() and ray_attacks()
and retire square_is_attacked(), use the corresponding definition
instead. It is more clear that we are computing full attack
info for the given square.

Alos fix some obsolete comments in move generation functions.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2009-09-20 08:43:25 +01:00
parent c5f44ef45b
commit 62a8f393f1
3 changed files with 18 additions and 28 deletions

View File

@@ -510,7 +510,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
// If the moving piece is a king, check whether the destination
// square is attacked by the opponent.
if (type_of_piece_on(from) == KING)
return !(square_is_attacked(move_to(m), opposite_color(us)));
return !attacks_to(move_to(m), opposite_color(us));
// A non-king move is legal if and only if it is not pinned or it
// is moving along the ray towards or away from the king.
@@ -1923,7 +1923,7 @@ bool Position::is_ok(int* failedStep) const {
Color us = side_to_move();
Color them = opposite_color(us);
Square ksq = king_square(them);
if (square_is_attacked(ksq, us))
if (attacks_to(ksq, us))
return false;
}