From b044a0f139784b8075467dc5e9c6b1a45e78d6d5 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 10 Nov 2008 20:54:34 +0000 Subject: * refactor: Make xml (orig format) loading method reuse existing set root part method * miscellaneous doc/log message changes --- .../Region/Environment/Scenes/SceneObjectGroup.cs | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index ed087a4..9afe8cd 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -398,10 +398,7 @@ namespace OpenSim.Region.Environment.Scenes reader.Read(); reader.ReadStartElement("SceneObjectGroup"); reader.ReadStartElement("RootPart"); - m_rootPart = SceneObjectPart.FromXml(reader); - int linkNum = m_rootPart.LinkNum; - AddPart(m_rootPart); - m_rootPart.LinkNum = linkNum; + SetRootPart(SceneObjectPart.FromXml(reader)); reader.ReadEndElement(); @@ -414,7 +411,9 @@ namespace OpenSim.Region.Environment.Scenes { reader.Read(); SceneObjectPart part = SceneObjectPart.FromXml(reader); - linkNum = part.LinkNum; + + // We reset the link number in order to make sure that the persisted linkset order is + int linkNum = part.LinkNum; AddPart(part); part.LinkNum = linkNum; @@ -428,11 +427,9 @@ namespace OpenSim.Region.Environment.Scenes } } } - catch (XmlException) + catch (XmlException e) { - m_log.ErrorFormat("[SCENE OBJECT GROUP]: Deserialization of following xml failed, {0}", xmlData); - - // Let's see if carrying on does anything for us + m_log.ErrorFormat("[SCENE]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); } reader.Close(); @@ -885,6 +882,9 @@ namespace OpenSim.Region.Environment.Scenes part.ParentID = 0; part.LinkNum = 0; m_rootPart = part; + + // No locking required since the SOG should not be in the scene yet - one can't change root parts after + // the scene object has been attached to the scene m_parts.Add(m_rootPart.UUID, m_rootPart); } @@ -1460,6 +1460,12 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// Set the owner of the root part. + /// + /// + /// + /// public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID) { part.LastOwnerID = part.OwnerID; -- cgit v1.1