aboutsummaryrefslogtreecommitdiff
path: root/src/moves.cpp
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-07-28 19:04:46 +0200
committerAdam <adammegarules1@gmail.com>2026-07-28 19:04:46 +0200
commitccb929172587fbfb8fb000d7992bdbbdac6f53ae (patch)
tree9a273513c50284a20266361b3f5304c539975fe2 /src/moves.cpp
parent40e242dc5450e1661c817b0bad8f9748388c278a (diff)
renaming none to none piece
Diffstat (limited to 'src/moves.cpp')
-rw-r--r--src/moves.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/moves.cpp b/src/moves.cpp
index 638e01a..e1289db 100644
--- a/src/moves.cpp
+++ b/src/moves.cpp
@@ -25,7 +25,7 @@ void GenerateKnightMoves(Game *b, int from, std::vector<Move> &moves) {
if (fileDelta != 1 && fileDelta != 2) {
continue;
};
- if (b->pieces[next].type != NONE) {
+ if (b->pieces[next].type != NONEPIECE) {
if (b->pieces[next].color == b->turn) {
continue;
};
@@ -51,7 +51,7 @@ void GeneratePawnMoves(Game *b, int from, std::vector<Move> &moves) {
}
// if piece it want to move to is none and it as legal move
- if (b->pieces[next].type == NONE) {
+ if (b->pieces[next].type == NONEPIECE) {
if (position.rank + (pawn.color ? -1 : 1) == 0 ||
position.rank + (pawn.color ? -1 : 1) == 7) {
moves.push_back({position, IndexToPosition(next), QUEEN});
@@ -64,7 +64,8 @@ void GeneratePawnMoves(Game *b, int from, std::vector<Move> &moves) {
int startingRank = pawn.color ? 6 : 1;
int twoSteps = from + step * 2;
- if (position.rank == startingRank && b->pieces[twoSteps].type == NONE) {
+ if (position.rank == startingRank &&
+ b->pieces[twoSteps].type == NONEPIECE) {
moves.push_back({position, IndexToPosition(twoSteps)});
}
}
@@ -84,7 +85,7 @@ void GeneratePawnMoves(Game *b, int from, std::vector<Move> &moves) {
moves.push_back({position, IndexToPosition(target)});
}
- if (b->pieces[target].type != NONE &&
+ if (b->pieces[target].type != NONEPIECE &&
b->pieces[target].color != pawn.color) {
if (targetRank == 0 || targetRank == 7) {
moves.push_back({position, IndexToPosition(target), QUEEN});
@@ -108,7 +109,7 @@ std::vector<Move> GetPseudoLegalMoves(Game *b) {
for (uint i = 0; i < sizeof(b->pieces) / sizeof(b->pieces[0]); i++) {
Piece piece = b->pieces[i];
- if (piece.type == NONE) {
+ if (piece.type == NONEPIECE) {
continue;
}
if (piece.color != b->turn)
@@ -237,7 +238,7 @@ void GenerateSlidingMoves(Game *b, int from,
if (i2 >= 64 || i2 < 0) {
break;
}
- if (b->pieces[i2].color == b->turn && b->pieces[i2].type != NONE) {
+ if (b->pieces[i2].color == b->turn && b->pieces[i2].type != NONEPIECE) {
break;
}
if ((direction == 1 || direction == -1) &&
@@ -245,7 +246,7 @@ void GenerateSlidingMoves(Game *b, int from,
break;
}
moves.push_back({IndexToPosition(from), IndexToPosition(i2)});
- if (b->pieces[i2].color != b->turn && b->pieces[i2].type != NONE) {
+ if (b->pieces[i2].color != b->turn && b->pieces[i2].type != NONEPIECE) {
break;
}
}
@@ -270,7 +271,7 @@ void GenerateKingMoves(Game *b, int from, std::vector<Move> &moves) {
if (std::abs((next % 8) - (from % 8)) > 1) {
continue;
};
- if (b->pieces[next].type != NONE) {
+ if (b->pieces[next].type != NONEPIECE) {
if (b->pieces[next].color == b->turn) {
continue;
};