feat: add undo
This commit is contained in:
@@ -2,14 +2,18 @@ package chess.controller.commands;
|
||||
|
||||
import chess.controller.Command;
|
||||
import chess.controller.OutputSystem;
|
||||
import chess.controller.PlayerCommand;
|
||||
import chess.model.Game;
|
||||
|
||||
public class UndoCommand extends Command{
|
||||
|
||||
@Override
|
||||
public CommandResult execute(Game game, OutputSystem outputSystem) {
|
||||
//TODO
|
||||
return CommandResult.Moved;
|
||||
PlayerCommand lastAction = game.getLastAction();
|
||||
if (lastAction == null)
|
||||
return CommandResult.NotAllowed;
|
||||
|
||||
return lastAction.undo(game, outputSystem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user