summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 8181d7c..b18c7ea 100644
--- a/src/main.c
+++ b/src/main.c
@@ -141,8 +141,15 @@ int validate_move(int move[2], int color, int* board) {
legal_move = kingMoves;
break;
case PAWN:
- if (piece & BLACK) legal_move = blackPawnMoves;
- else legal_move = pawnMoves;
+ if (piece & BLACK) {
+ if (board[destination] != EMPTY) legal_move = blackPawnAttackMoves;
+ else if (origin >> 4 == 6) legal_move = newBlackPawnMoves;
+ else legal_move = blackPawnMoves;
+ } else {
+ if (board[destination] != EMPTY) legal_move = pawnAttackMoves;
+ else if (origin >> 4 == 1) legal_move = newPawnMoves;
+ else legal_move = pawnMoves;
+ }
break;
default:
return -2;