small refactoring to get rid of compiler warning
This commit is contained in:
parent
72f3431418
commit
42484f4217
@ -12,8 +12,7 @@ std::vector<Move> pawn_moves(const Board& b, const Coords xy) {
|
|||||||
int dy = my_colour == Colour::White ? 1 : -1;
|
int dy = my_colour == Colour::White ? 1 : -1;
|
||||||
Coords left{xy.x - 1, xy.y + dy};
|
Coords left{xy.x - 1, xy.y + dy};
|
||||||
int8_t capturable_piece = b.squares[left.to_index()];
|
int8_t capturable_piece = b.squares[left.to_index()];
|
||||||
if (capturable_piece != 0) {
|
if (capturable_piece != 0 && my_colour != b.colour_at(left)) {
|
||||||
if (my_colour != b.colour_at(left))
|
|
||||||
if ((my_colour == White && left.y == 7)
|
if ((my_colour == White && left.y == 7)
|
||||||
|| (my_colour == Black && left.y == 0))
|
|| (my_colour == Black && left.y == 0))
|
||||||
for (auto piece : {Rook, Knigt, Bishop, Queen})
|
for (auto piece : {Rook, Knigt, Bishop, Queen})
|
||||||
@ -32,8 +31,7 @@ std::vector<Move> pawn_moves(const Board& b, const Coords xy) {
|
|||||||
int dy = my_colour == Colour::White ? 1 : -1;
|
int dy = my_colour == Colour::White ? 1 : -1;
|
||||||
Coords right{xy.x + 1, xy.y + dy};
|
Coords right{xy.x + 1, xy.y + dy};
|
||||||
int8_t capturable_piece = b.squares[right.to_index()];
|
int8_t capturable_piece = b.squares[right.to_index()];
|
||||||
if (capturable_piece != 0) {
|
if (capturable_piece != 0 && my_colour != b.colour_at(right)) {
|
||||||
if (my_colour != b.colour_at(right))
|
|
||||||
if ((my_colour == White && right.y == 7)
|
if ((my_colour == White && right.y == 7)
|
||||||
|| (my_colour == Black && right.y == 0))
|
|| (my_colour == Black && right.y == 0))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user