castling can be undone et redo, but only for the concerned castle, the

king will still move and the castlking variable for the other type of
castle will get + 1, still an improvement
This commit is contained in:
hugomanipoud2 2025-05-23 13:11:11 +02:00
parent a37a1a8d76
commit c7d7991a16
2 changed files with 6 additions and 1 deletions

View File

@ -279,6 +279,7 @@ public class Board {
pieces.clear(); // removes all pieces from arraylist of pieces used
pieces.addAll(previousState); // add all pieces from previous state of board to arraylist
boardHistory.remove(turnNb + 1);
move.moveResetCastlingVar(turnNb);
}else if (turnNb == 1) {
turnNb--;
@ -286,6 +287,8 @@ public class Board {
boardHistory.clear();
populateBoard();
}
}

View File

@ -393,7 +393,9 @@ public boolean isKingMoveValid(int x, int y, boolean color, int selectX, int se
}
public void moveResetCastlingVar(int turnNb) {
specialMoves.resetCastlingVar(turnNb);
}