annotate Commands/CommandStack.cs @ 108:27b6aa1e98e8

Re #12: Document classes and methods * Document the Constants (Also - test new Hg repo and hooks)
author IBBoard <dev@ibboard.co.uk>
date Sun, 14 Aug 2011 14:34:12 +0100
parents 2baf3f949cfb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
0352fa33ee8f Closes #8 - license code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
1 // This file (CommandStack.cs) is a part of the IBBoard library and is copyright 2009 IBBoard.
0352fa33ee8f Closes #8 - license code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
2 //
0352fa33ee8f Closes #8 - license code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
0352fa33ee8f Closes #8 - license code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
4
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
5 using System;
41
d5dcd1c09c28 * Make sure we reset "cleanPos" in the command stack when we clear it
IBBoard <dev@ibboard.co.uk>
parents: 37
diff changeset
6 using System.Collections.Generic;
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
7
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
8 namespace IBBoard.Commands
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
9 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
10 /// <summary>
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
11 /// Summary description for CommandStack.
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
12 /// </summary>
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
13 public class CommandStack
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
14 {
41
d5dcd1c09c28 * Make sure we reset "cleanPos" in the command stack when we clear it
IBBoard <dev@ibboard.co.uk>
parents: 37
diff changeset
15 private List<Command> commandStack;
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
16 private int listPos = -1;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
17 private int listMax = -1;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
18 private int cleanPos;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
19
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
20 public event MethodInvoker CommandStackUpdated;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
21
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
22 public CommandStack()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
23 {
41
d5dcd1c09c28 * Make sure we reset "cleanPos" in the command stack when we clear it
IBBoard <dev@ibboard.co.uk>
parents: 37
diff changeset
24 commandStack = new List<Command>(10);
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
25 cleanPos = -1;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
26 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
27
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
28 public bool IsDirty()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
29 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
30 return listPos!=cleanPos;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
31 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
32
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
33 public void setCleanMark()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
34 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
35 cleanPos = listPos;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
36 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
38 public bool IsEmpty()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
39 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
40 return listMax == -1;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
41 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
42
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
43 public bool CanUndo()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
44 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
45 return listPos > -1;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
46 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
47
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
48 public int UndoLength
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
49 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
50 get { return listPos + 1; }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
51 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
52
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
53 public int RedoLength
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
54 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
55 get { return listMax - listPos; }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
56 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
57
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
58 public bool CanRedo()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
59 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
60 return listPos < listMax;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
61 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
62
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
63 public void Reset()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
64 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
65 commandStack.Clear();
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
66 listMax = -1;
43
2baf3f949cfb * Make sure that we use "." as our decimal separator when parsing doubles from XML (should fix warfoundry:#185 for Europe)
IBBoard <dev@ibboard.co.uk>
parents: 41
diff changeset
67 listPos = -1;
41
d5dcd1c09c28 * Make sure we reset "cleanPos" in the command stack when we clear it
IBBoard <dev@ibboard.co.uk>
parents: 37
diff changeset
68 cleanPos = -1;
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
69 DoCommandStackUpdated();
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
70 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
71
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
72 public void Undo()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
73 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
74 if (CanUndo())
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
75 {
41
d5dcd1c09c28 * Make sure we reset "cleanPos" in the command stack when we clear it
IBBoard <dev@ibboard.co.uk>
parents: 37
diff changeset
76 commandStack[listPos].Undo();
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
77 listPos--;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
78 DoCommandStackUpdated();
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
79 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
80 else
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
81 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
82 throw new InvalidOperationException("Cannot undo action on empty command stack");
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
83 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
84 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
85
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
86 public void Redo()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
87 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
88 if (CanRedo())
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
89 {
41
d5dcd1c09c28 * Make sure we reset "cleanPos" in the command stack when we clear it
IBBoard <dev@ibboard.co.uk>
parents: 37
diff changeset
90 commandStack[listPos+1].Redo();
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
91 listPos++;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
92 DoCommandStackUpdated();
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
93 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
94 else
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
95 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
96 throw new InvalidOperationException("No actions to redo");
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
97 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
98 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
99
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
100 public bool Execute(Command cmd)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
101 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
102 if (cmd.CanExecute())
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
103 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
104 if (cmd.Execute())
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
105 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
106 //if we can't redo, i.e. there's no commands beyond our current point, add to the end else insert
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
107 if (!CanRedo())
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
108 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
109 commandStack.Add(cmd);
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
110 listPos++;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
111 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
112 else
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
113 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
114 if (cleanPos>listPos)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
115 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
116 cleanPos = -2;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
117 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
118
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
119 //else overwrite at our current position, setting the listMax value will ignore any commands we could have redone beyond here
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
120 commandStack[++listPos] = cmd;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
121 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
122
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
123 listMax = listPos;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
124 DoCommandStackUpdated();
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
125 return true;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
126 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
127 else
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
128 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
129 throw new InvalidOperationException("Executable command failed to execute");
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
130 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
131 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
132 else
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
133 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
134 return false;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
135 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
136 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
137
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
138 protected void DoCommandStackUpdated()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
139 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
140 if (CommandStackUpdated!=null)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
141 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
142 CommandStackUpdated();
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
143 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
144 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
145
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
146 public Command PeekUndoCommand()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
147 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
148 return PeekUndoCommand(1);
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
149 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
150
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
151 public Command PeekUndoCommand(int backCount)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
152 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
153 backCount = backCount - 1;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
154 if (backCount > -1 && backCount <= listPos)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
155 {
41
d5dcd1c09c28 * Make sure we reset "cleanPos" in the command stack when we clear it
IBBoard <dev@ibboard.co.uk>
parents: 37
diff changeset
156 return commandStack[listPos-backCount];
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
157 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
158 else
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
159 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
160 return null;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
161 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
162 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
163
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
164 public Command PeekRedoCommand()
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
165 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
166 return PeekRedoCommand(1);
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
167 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
168
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
169 public Command PeekRedoCommand(int forwardCount)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
170 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
171 if (forwardCount > 0 && listPos+forwardCount <= listMax)
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
172 {
41
d5dcd1c09c28 * Make sure we reset "cleanPos" in the command stack when we clear it
IBBoard <dev@ibboard.co.uk>
parents: 37
diff changeset
173 return commandStack[listPos+forwardCount];
37
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
174 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
175 else
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
176 {
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
177 return null;
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
178 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
179 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
180 }
cc7fae81afec * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
181 }