Ejemplo n.º 1
0
        // Discard redo stack if item is added to move history
        public void AddItem(HistoryItem newItem)
        {
            Future = new Stack <HistoryItem>();

            Past.Push(newItem);
            CurrItem = Past.Peek();
        }
Ejemplo n.º 2
0
        public void Redo()
        {
            int currTurn   = CurrItem.Turn;
            int targetTurn = currTurn + 2;

            while (Future.Count > 0 && currTurn != targetTurn)
            {
                Past.Push(Future.Pop());

                CurrItem = Past.Peek();
                currTurn = CurrItem.Turn;
            }

            // check if can redo
            //if (Future.Count > 1)
            //{
            //    Past.Push(Future.Pop());
            //    Past.Push(Future.Pop());

            //    CurrItem = Past.Peek();
            //}
        }