promote not that uggly
This commit is contained in:
@@ -17,6 +17,8 @@ import chess.io.OutputSystem;
|
||||
import chess.io.commands.GetAllowedMovesCommand;
|
||||
import chess.io.commands.GetPieceAtCommand;
|
||||
import chess.io.commands.MoveCommand;
|
||||
import chess.io.commands.PromoteCommand;
|
||||
import chess.io.commands.PromoteCommand.PromoteType;
|
||||
import chess.model.Coordinate;
|
||||
import chess.model.Move;
|
||||
import chess.model.Piece;
|
||||
@@ -96,9 +98,9 @@ public class Window extends JFrame implements OutputSystem {
|
||||
|
||||
private boolean previewMoves(int x, int y) {
|
||||
GetAllowedMovesCommand movesCommand = new GetAllowedMovesCommand(new Coordinate(x, y));
|
||||
if(sendCommand(movesCommand) == CommandResult.NotAllowed)
|
||||
if (sendCommand(movesCommand) == CommandResult.NotAllowed)
|
||||
return false;
|
||||
|
||||
|
||||
List<Coordinate> allowedMoves = movesCommand.getDestinations();
|
||||
if (allowedMoves.isEmpty())
|
||||
return false;
|
||||
@@ -180,4 +182,10 @@ public class Window extends JFrame implements OutputSystem {
|
||||
buildBoard();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void promotePawn(Coordinate pieceCoords) {
|
||||
System.out.println("PROMOTE");
|
||||
sendCommand(new PromoteCommand(PromoteType.Queen, pieceCoords));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user