Use a standard generic system stack for the undo/redo stacks instead of our own homebrew.

system stack also uses an array, so no performance penalty.
Also exposes undo count and adds a test assertion for correct undo count after resize
This commit is contained in:
Justin Clark-Casey (justincc)
2011-07-18 02:01:12 +01:00
parent bdd340b9fc
commit 3f8e571b78
3 changed files with 55 additions and 3 deletions

View File

@@ -287,8 +287,8 @@ namespace OpenSim.Region.Framework.Scenes
private string m_sitAnimation = "SIT";
private string m_text = String.Empty;
private string m_touchName = String.Empty;
private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
private readonly UndoStack<UndoState> m_redo = new UndoStack<UndoState>(5);
private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5);
private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5);
private UUID _creatorID;
private bool m_passTouches;
@@ -3707,6 +3707,18 @@ namespace OpenSim.Region.Framework.Scenes
// }
}
/// <summary>
/// Return number of undos on the stack. Here temporarily pending a refactor.
/// </summary>
public int UndoCount
{
get
{
lock (m_undo)
return m_undo.Count;
}
}
public void Undo()
{
// m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId);