castling bug really fixed
This commit is contained in:
parent
da59350569
commit
6cb9135501
|
|
@ -759,14 +759,14 @@ public class Board {
|
|||
boolean occupiedLeftLine = true;
|
||||
boolean occupiedRightLine = true;
|
||||
|
||||
for(int i = 4; i > 0; i--) {
|
||||
if (positionOccupied(i,pieces.get(indexPieceSelect).getY()) == true) {
|
||||
for(int i1 = 3; i1 > 0; i1--) {
|
||||
if (positionOccupied(i1,pieces.get(indexPieceSelect).getY()) == true) {
|
||||
nbOccupied = nbOccupied + 1;
|
||||
}
|
||||
if (nbOccupied == 0) {
|
||||
occupiedLeftLine=false;
|
||||
}
|
||||
}
|
||||
if (nbOccupied == 0) {
|
||||
occupiedLeftLine=false;
|
||||
}
|
||||
if (occupiedLeftLine == false) {//check if the castling is possible with the rooks on the left
|
||||
if (kingWMoved == false && rookLWMoved == false && x==0 && y==7 && pieces.get(whatPiece(0,7)).isWhite() == pieces.get(indexPieceSelect).isWhite()) {
|
||||
toHighlight.get(0).add(x);
|
||||
|
|
@ -783,14 +783,14 @@ public class Board {
|
|||
}
|
||||
}
|
||||
nbOccupied = 0;
|
||||
for(int i = 4; i < 7; i++) {
|
||||
if (positionOccupied(i,pieces.get(indexPieceSelect).getY()) == true) {
|
||||
for(int i2 = 5; i2 < 7; i2++) {
|
||||
if (positionOccupied(i2,pieces.get(indexPieceSelect).getY()) == true) {
|
||||
nbOccupied = nbOccupied + 1;
|
||||
}
|
||||
if (nbOccupied == 0) {
|
||||
occupiedRightLine=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nbOccupied == 0) {
|
||||
occupiedRightLine=false;
|
||||
}
|
||||
if (occupiedRightLine == false) {//check if the castling is possible with the rooks on the right
|
||||
if (kingWMoved == false && rookRWMoved == false && x==7 && y==7 && pieces.get(whatPiece(7,7)).isWhite() == pieces.get(indexPieceSelect).isWhite()) {
|
||||
toHighlight.get(0).add(x);
|
||||
|
|
|
|||
Loading…
Reference in New Issue