Rename piece_attacks() in piece_attacks_from()

It is a bit longer but much easier to understand especially
for people new to the sources. I remember it was not trivial
for me to understand the returned attack bitboard refers to
attacks launched from the given square and not attacking the
given square.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2009-09-20 10:26:54 +01:00
parent f74f42b298
commit 6845397c5c
7 changed files with 80 additions and 79 deletions

View File

@@ -303,7 +303,7 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) {
if ( passed
|| isolated
|| chain
|| (pos.pawn_attacks(s, us) & theirPawns)
|| (pos.pawn_attacks_from(s, us) & theirPawns)
|| (ourPawns & behind_bb(us, r) & neighboring_files_bb(f)))
backward = false;
else
@@ -312,7 +312,7 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) {
// pawn on neighboring files. We now check whether the pawn is
// backward by looking in the forward direction on the neighboring
// files, and seeing whether we meet a friendly or an enemy pawn first.
Bitboard b = pos.pawn_attacks(s, us);
Bitboard b = pos.pawn_attacks_from(s, us);
if (us == WHITE)
{
for ( ; !(b & (ourPawns | theirPawns)); b <<= 8);