diff options
author | Justin Clark-Casey (justincc) | 2012-09-26 23:25:50 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-09-26 23:25:50 +0100 |
commit | 31c636f1e48db2a42950e2ec0e8c7eba2c16616c (patch) | |
tree | 26563e1cd1c70b1475c9b9ff59e0d50c8d3b1aff /OpenSim/Region | |
parent | Make it possible to rescale SOGs when they are not in a scene. (diff) | |
download | opensim-SC-31c636f1e48db2a42950e2ec0e8c7eba2c16616c.zip opensim-SC-31c636f1e48db2a42950e2ec0e8c7eba2c16616c.tar.gz opensim-SC-31c636f1e48db2a42950e2ec0e8c7eba2c16616c.tar.bz2 opensim-SC-31c636f1e48db2a42950e2ec0e8c7eba2c16616c.tar.xz |
refactor: Change control structures in SOP.StoreUndoState() to reduce nesting.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 018e4fc..8710c3e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3170,64 +3170,62 @@ namespace OpenSim.Region.Framework.Scenes | |||
3170 | 3170 | ||
3171 | public void StoreUndoState(bool forGroup) | 3171 | public void StoreUndoState(bool forGroup) |
3172 | { | 3172 | { |
3173 | if (!Undoing) | 3173 | if (Undoing) |
3174 | { | 3174 | { |
3175 | if (!IgnoreUndoUpdate) | 3175 | // m_log.DebugFormat( |
3176 | // "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); | ||
3177 | return; | ||
3178 | } | ||
3179 | |||
3180 | if (IgnoreUndoUpdate) | ||
3181 | { | ||
3182 | // m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); | ||
3183 | return; | ||
3184 | } | ||
3185 | |||
3186 | if (ParentGroup == null) | ||
3187 | return; | ||
3188 | |||
3189 | lock (m_undo) | ||
3190 | { | ||
3191 | if (m_undo.Count > 0) | ||
3176 | { | 3192 | { |
3177 | if (ParentGroup != null) | 3193 | UndoState last = m_undo[m_undo.Count - 1]; |
3194 | if (last != null) | ||
3178 | { | 3195 | { |
3179 | lock (m_undo) | 3196 | // TODO: May need to fix for group comparison |
3197 | if (last.Compare(this)) | ||
3180 | { | 3198 | { |
3181 | if (m_undo.Count > 0) | 3199 | // m_log.DebugFormat( |
3182 | { | 3200 | // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", |
3183 | UndoState last = m_undo[m_undo.Count - 1]; | 3201 | // Name, LocalId, m_undo.Count); |
3184 | if (last != null) | 3202 | |
3185 | { | 3203 | return; |
3186 | // TODO: May need to fix for group comparison | 3204 | } |
3187 | if (last.Compare(this)) | 3205 | } |
3188 | { | 3206 | } |
3189 | // m_log.DebugFormat( | 3207 | |
3190 | // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", | ||
3191 | // Name, LocalId, m_undo.Count); | ||
3192 | |||
3193 | return; | ||
3194 | } | ||
3195 | } | ||
3196 | } | ||
3197 | |||
3198 | // m_log.DebugFormat( | 3208 | // m_log.DebugFormat( |
3199 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", | 3209 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", |
3200 | // Name, LocalId, forGroup, m_undo.Count); | 3210 | // Name, LocalId, forGroup, m_undo.Count); |
3201 | |||
3202 | if (ParentGroup.GetSceneMaxUndo() > 0) | ||
3203 | { | ||
3204 | UndoState nUndo = new UndoState(this, forGroup); | ||
3205 | |||
3206 | m_undo.Add(nUndo); | ||
3207 | 3211 | ||
3208 | if (m_undo.Count > ParentGroup.GetSceneMaxUndo()) | 3212 | if (ParentGroup.GetSceneMaxUndo() > 0) |
3209 | m_undo.RemoveAt(0); | 3213 | { |
3210 | 3214 | UndoState nUndo = new UndoState(this, forGroup); | |
3211 | if (m_redo.Count > 0) | 3215 | |
3212 | m_redo.Clear(); | 3216 | m_undo.Add(nUndo); |
3213 | 3217 | ||
3218 | if (m_undo.Count > ParentGroup.GetSceneMaxUndo()) | ||
3219 | m_undo.RemoveAt(0); | ||
3220 | |||
3221 | if (m_redo.Count > 0) | ||
3222 | m_redo.Clear(); | ||
3223 | |||
3214 | // m_log.DebugFormat( | 3224 | // m_log.DebugFormat( |
3215 | // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", | 3225 | // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", |
3216 | // Name, LocalId, forGroup, m_undo.Count); | 3226 | // Name, LocalId, forGroup, m_undo.Count); |
3217 | } | ||
3218 | } | ||
3219 | } | ||
3220 | } | 3227 | } |
3221 | // else | ||
3222 | // { | ||
3223 | // m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); | ||
3224 | // } | ||
3225 | } | 3228 | } |
3226 | // else | ||
3227 | // { | ||
3228 | // m_log.DebugFormat( | ||
3229 | // "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); | ||
3230 | // } | ||
3231 | } | 3229 | } |
3232 | 3230 | ||
3233 | /// <summary> | 3231 | /// <summary> |