aboutsummaryrefslogtreecommitdiff
path: root/src/moves.cpp
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-08-12 09:06:44 +0200
committerAdam <adammegarules1@gmail.com>2026-08-12 09:06:44 +0200
commit8cdb6b99332b57bbc67758095cd740836060a015 (patch)
tree6d069fee70a56081b29b737863330d2ad067939d /src/moves.cpp
parent54d024aae8ca232e8da4cf4620ca9c5b3b599f23 (diff)
fixing
Diffstat (limited to 'src/moves.cpp')
-rw-r--r--src/moves.cpp9
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;
+ }
}
}