improved the highlight thingy. the enpassant needs reviewing
This commit is contained in:
parent
a399856219
commit
4fadb597ab
|
|
@ -7,11 +7,13 @@ public class MoveHighlighter {
|
||||||
ArrayList<int[]> validMoves = new ArrayList<int[]>();
|
ArrayList<int[]> validMoves = new ArrayList<int[]>();
|
||||||
MovePiece movement = new MovePiece(piece, board);
|
MovePiece movement = new MovePiece(piece, board);
|
||||||
PieceType type= piece.getType();
|
PieceType type= piece.getType();
|
||||||
|
|
||||||
//looping through each square space
|
//looping through each square space
|
||||||
for (int x = 0; x < board.getWidth(); x++) {
|
for (int x = 0; x < board.getWidth(); x++) {
|
||||||
for (int y = 0; y < board.getHeight(); y++) {
|
for (int y = 0; y < board.getHeight(); y++) {
|
||||||
boolean valid=false;
|
boolean valid=false;
|
||||||
|
System.out.println("MoveHighlighter: checking (" + x + "," + y + ") for type " + type);
|
||||||
|
|
||||||
if(type==PieceType.Pawn) {
|
if(type==PieceType.Pawn) {
|
||||||
valid=movement.movePawnSimulate(x, y);
|
valid=movement.movePawnSimulate(x, y);
|
||||||
} else if(type==PieceType.Rook) {
|
} else if(type==PieceType.Rook) {
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ public class MovePiece {
|
||||||
int stepY = (targetY > currentY) ? 1 : -1;
|
int stepY = (targetY > currentY) ? 1 : -1;
|
||||||
int x = currentX + stepX;
|
int x = currentX + stepX;
|
||||||
int y = currentY + stepY;
|
int y = currentY + stepY;
|
||||||
while (x != targetX && y != targetY) {
|
while (x != targetX) {
|
||||||
if (board.getPiece(x, y) != null) {
|
if (board.getPiece(x, y) != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue