From 248fdbda92892a2b14b8818d2ba58d591580a968 Mon Sep 17 00:00:00 2001 From: hugomanipoud2 Date: Thu, 22 May 2025 21:27:00 +0200 Subject: [PATCH] Castling is fully functional, i needed to split long and short, idk it works so thats a win --- OOP_3B5_Project/src/backend/Move.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/OOP_3B5_Project/src/backend/Move.java b/OOP_3B5_Project/src/backend/Move.java index e54bfa9..76d1e09 100644 --- a/OOP_3B5_Project/src/backend/Move.java +++ b/OOP_3B5_Project/src/backend/Move.java @@ -20,24 +20,20 @@ public class Move { //helper function to change the coordinates of a piece public void movePiece(int selectX, int selectY, int toX, int toY) { Piece movingPiece = null ; // initializing variable to work with and store it - PieceType type = null; - boolean color = true; int turnNb = board.getTurnNumber(); // Increment turn number and change turn color; // Increment turn number and change turn color for (Piece piece : pieces) { // iterate trough all pieces if(piece.getX() == selectX && piece.getY() == selectY) { // if the coordinates selected and the coordinate of a piece on the board matches, the loop will activate - movingPiece = piece; //storing in memory the piece - type = movingPiece.getType(); - color = movingPiece.isWhite(); - + movingPiece = piece; //storing in memory the piece if (board.isHighlighted(toX, toY)) { // only allow the value of cases that are set to true as isHghlighted is a bool function if (board.isAPieceThere(toX, toY)){//checking if a piece is at the arrival coordinates needPieceDeletion(toX, toY); //if a piece is at arrival coord, remove the piece } specialMoves.pawnPromotion(movingPiece, toY); - specialMoves.castling(movingPiece, toX, toY); + specialMoves.castlingShort(movingPiece, toX, toY); + specialMoves.castlingLong(movingPiece, toX, toY); movingPiece.setX(toX); // change coordinates to the new coordinate movingPiece.setY(toY); board.setTurnNb(turnNb + 1);