[board] Convert a few more Piece and PlacedPiece to pass by ref
This commit is contained in:
parent
8835d8b40e
commit
683d89b726
2 changed files with 4 additions and 4 deletions
|
@ -156,7 +156,7 @@ impl<'p> Builder<'p, ValidatedMove> {
|
||||||
if let Some(promotion) = promotion {
|
if let Some(promotion) = promotion {
|
||||||
pieces.remove_piece(&moving_piece);
|
pieces.remove_piece(&moving_piece);
|
||||||
let _ = pieces
|
let _ = pieces
|
||||||
.place_piece(PlacedPiece::new(Piece::new(player, promotion), to_square));
|
.place_piece(&PlacedPiece::new(Piece::new(player, promotion), to_square));
|
||||||
} else {
|
} else {
|
||||||
pieces.move_piece(moving_piece.piece(), from_square, to_square);
|
pieces.move_piece(moving_piece.piece(), from_square, to_square);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,13 +74,13 @@ impl PieceBitBoards {
|
||||||
self.by_color_and_shape.bitboard_for_piece_mut(piece)
|
self.by_color_and_shape.bitboard_for_piece_mut(piece)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn place_piece(&mut self, piece: PlacedPiece) -> Result<(), PlacePieceError> {
|
pub(super) fn place_piece(&mut self, piece: &PlacedPiece) -> Result<(), PlacePieceError> {
|
||||||
self.place_piece_with_strategy(piece, Default::default())
|
self.place_piece_with_strategy(piece, Default::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn place_piece_with_strategy(
|
pub(super) fn place_piece_with_strategy(
|
||||||
&mut self,
|
&mut self,
|
||||||
piece: PlacedPiece,
|
piece: &PlacedPiece,
|
||||||
strategy: PlacePieceStrategy,
|
strategy: PlacePieceStrategy,
|
||||||
) -> Result<(), PlacePieceError> {
|
) -> Result<(), PlacePieceError> {
|
||||||
let color = piece.color();
|
let color = piece.color();
|
||||||
|
@ -124,7 +124,7 @@ impl FromIterator<PlacedPiece> for PieceBitBoards {
|
||||||
let mut pieces = Self::default();
|
let mut pieces = Self::default();
|
||||||
|
|
||||||
for piece in iter {
|
for piece in iter {
|
||||||
let _ = pieces.place_piece(piece);
|
let _ = pieces.place_piece(&piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
pieces
|
pieces
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue