diff options
Diffstat (limited to 'src/moves.cpp')
| -rw-r--r-- | src/moves.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/moves.cpp b/src/moves.cpp index b7b1688..812e734 100644 --- a/src/moves.cpp +++ b/src/moves.cpp @@ -114,7 +114,7 @@ void GeneratePawnMoves(Game *b, int from, std::vector<Move> &moves, int twoSteps = from + (step * 2); if (position.rank == startingRank && b->pieces[twoSteps].type == NONEPIECE) { - moves.push_back({position, IndexToPosition(twoSteps)}); + moves.push_back({.From = position, .To = IndexToPosition(twoSteps)}); } }; @@ -155,7 +155,6 @@ void GeneratePawnMoves(Game *b, int from, std::vector<Move> &moves, }); } else { moves.push_back({.From = position, .To = IndexToPosition(target)}); - moves.push_back({.From = position, .To = IndexToPosition(target)}); } } } @@ -188,7 +187,8 @@ void GenerateKingMoves(Game *g, int from, std::vector<Move> &moves, continue; } - moves.push_back({IndexToPosition(from), IndexToPosition(next)}); + moves.push_back( + {.From = IndexToPosition(from), .To = IndexToPosition(next)}); } }; @@ -251,8 +251,9 @@ bool IsSquareAttacked(Game *g, Position square, bool byColor) { continue; Piece p = g->pieces[pawnRank * 8 + file]; - if (p.type == PAWN && p.color == byColor) + if (p.type == PAWN && p.color == byColor) { return true; + } } } |
