/// <summary>
        ///     Undo the last command that has been done
        /// </summary>
        /// <returns>The last command, null if there is none</returns>
        public ICompensableCommand Undo()
        {
            if (_undoCommands.Count == 0)
            {
                return(null);
            }

            ICompensableCommand command = _undoCommands.Pop();

            command.Compensate();
            _redoCommands.Push(command);

            return(command);
        }
Пример #2
0
 public void Compensate()
 {
     _kingCommand.Compensate();
     _rookCommand.Compensate();
 }
Пример #3
0
 public void Compensate()
 {
     _secondMove.Compensate();
     _firstMove.Compensate();
 }
Пример #4
0
 public void Compensate()
 {
     _board.SquareAt(Move.TargetCoordinate).Piece = _oldPawn;
     _moveCommand.Compensate();
 }