promote gui
This commit is contained in:
@@ -24,6 +24,10 @@ public class MoveCommand extends Command {
|
||||
public CommandResult execute(Game game, OutputSystem outputSystem) {
|
||||
final ChessBoard board = game.getBoard();
|
||||
|
||||
// we must promote the pending pawn before
|
||||
if (game.pawnShouldBePromoted())
|
||||
return CommandResult.NotAllowed;
|
||||
|
||||
Piece piece = board.pieceAt(move.getStart());
|
||||
if (piece == null)
|
||||
return CommandResult.NotAllowed;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class PromoteCommand extends Command {
|
||||
board.pieceLeaves(this.pieceCoords);
|
||||
board.pieceComes(createPiece(this.promoteType, pawn.getColor()), this.pieceCoords);
|
||||
|
||||
return CommandResult.NotMoved;
|
||||
return CommandResult.Moved;
|
||||
}
|
||||
|
||||
private Piece createPiece(PromoteType promoteType, Color color) {
|
||||
|
||||
Reference in New Issue
Block a user