From 62b3e74bc5c3f08f33e15b30d04a799db4228c06 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Sep 2011 22:24:33 +0100
Subject: minor: remove redundant grp != null check from AM.UpdateKnownItem()
---
.../Avatar/Attachments/AttachmentsModule.cs | 69 +++++++++++-----------
1 file changed, 33 insertions(+), 36 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 1e9a001..ae19224 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -707,49 +707,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
///
public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
{
- if (grp != null)
+ if (grp.HasGroupChanged || grp.ContainsScripts())
{
- if (grp.HasGroupChanged || grp.ContainsScripts())
- {
- m_log.DebugFormat(
- "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
- grp.UUID, grp.AttachmentPoint);
+ m_log.DebugFormat(
+ "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
+ grp.UUID, grp.AttachmentPoint);
- string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
+ string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
- InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
- item = m_scene.InventoryService.GetItem(item);
+ InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
+ item = m_scene.InventoryService.GetItem(item);
- if (item != null)
- {
- AssetBase asset = m_scene.CreateAsset(
- grp.GetPartName(grp.LocalId),
- grp.GetPartDescription(grp.LocalId),
- (sbyte)AssetType.Object,
- Utils.StringToBytes(sceneObjectXml),
- remoteClient.AgentId);
- m_scene.AssetService.Store(asset);
-
- item.AssetID = asset.FullID;
- item.Description = asset.Description;
- item.Name = asset.Name;
- item.AssetType = asset.Type;
- item.InvType = (int)InventoryType.Object;
-
- m_scene.InventoryService.UpdateItem(item);
-
- // this gets called when the agent logs off!
- if (remoteClient != null)
- remoteClient.SendInventoryItemCreateUpdate(item, 0);
- }
- }
- else
+ if (item != null)
{
- m_log.DebugFormat(
- "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
- grp.UUID, grp.AttachmentPoint);
+ AssetBase asset = m_scene.CreateAsset(
+ grp.GetPartName(grp.LocalId),
+ grp.GetPartDescription(grp.LocalId),
+ (sbyte)AssetType.Object,
+ Utils.StringToBytes(sceneObjectXml),
+ remoteClient.AgentId);
+ m_scene.AssetService.Store(asset);
+
+ item.AssetID = asset.FullID;
+ item.Description = asset.Description;
+ item.Name = asset.Name;
+ item.AssetType = asset.Type;
+ item.InvType = (int)InventoryType.Object;
+
+ m_scene.InventoryService.UpdateItem(item);
+
+ // this gets called when the agent logs off!
+ if (remoteClient != null)
+ remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
}
+ else
+ {
+ m_log.DebugFormat(
+ "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
+ grp.UUID, grp.AttachmentPoint);
+ }
}
///
--
cgit v1.1