fix undo draw check
This commit is contained in:
@@ -34,6 +34,7 @@ public class MoveCommand extends PlayerCommand {
|
||||
|
||||
case Moved:
|
||||
outputSystem.onMove(this.move);
|
||||
game.saveTraitPiecesPos();
|
||||
return result;
|
||||
|
||||
case ActionNeeded:
|
||||
@@ -83,6 +84,7 @@ public class MoveCommand extends PlayerCommand {
|
||||
protected CommandResult undoImpl(Game game, GameListener outputSystem) {
|
||||
final ChessBoard board = game.getBoard();
|
||||
|
||||
game.undoTraitPiecesPos();
|
||||
board.undoMove(move, deadPiece);
|
||||
return CommandResult.Moved;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class NewGameCommand extends Command {
|
||||
board.pieceComes(new Queen(Color.White), new Coordinate(3, Coordinate.VALUE_MAX - 1));
|
||||
board.pieceComes(new King(Color.White), new Coordinate(4, Coordinate.VALUE_MAX - 1));
|
||||
|
||||
game.resetPlayerTurn();
|
||||
game.reset();
|
||||
|
||||
outputSystem.onGameStart();
|
||||
outputSystem.onPlayerTurn(game.getPlayerTurn());
|
||||
|
||||
@@ -85,6 +85,8 @@ public class PromoteCommand extends PlayerCommand {
|
||||
|
||||
assert promoted != null;
|
||||
|
||||
game.undoTraitPiecesPos();
|
||||
|
||||
board.pieceComes(this.oldPawn, this.pieceCoords);
|
||||
|
||||
game.getLastAction().undo(game, outputSystem);
|
||||
|
||||
Reference in New Issue
Block a user