From 1d234ca83f64b31b559ace3f63ebbba9f4903778 Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Sat, 9 May 2009 21:11:12 +0000 Subject: Fixed handling of inventory a bit - AssetType isn't InventoryType. Those enums contain different numbers. Use AssetType for the asset type, InventoryType for the inventory type. - The ToString method (or ToLower) of AssetType/InventoryType doesn't necessarily return the correct LLSD string. - Replaced several magic numbers by their corresponding enum. - Fixed the invType for gestures and animations in the library. This should fix Mantis #3610 and the non-terminating inventory loading --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 10 +++++----- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 88416d3..1dcdc06 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -490,7 +490,7 @@ namespace OpenSim.Region.Framework.Scenes if (Permissions.PropagatePermissions()) { - if (item.InvType == 6) + if (item.InvType == (int)InventoryType.Object) { itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13; @@ -899,7 +899,7 @@ namespace OpenSim.Region.Framework.Scenes TryGetAvatar(remoteClient.AgentId, out presence); byte[] data = null; - if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum + if (invType == (sbyte)InventoryType.Landmark && presence != null) { Vector3 pos = presence.AbsolutePosition; string strdata = String.Format( @@ -1098,7 +1098,7 @@ namespace OpenSim.Region.Framework.Scenes if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) { - if (taskItem.InvType == 6) + if (taskItem.InvType == (int)InventoryType.Object) agentItem.BasePermissions = taskItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13); else agentItem.BasePermissions = taskItem.BasePermissions; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 6bf1654..d03fec2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -776,7 +776,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (TaskInventoryItem item in m_items.Values) { - if (item.InvType != 6) + if (item.InvType != (int)InventoryType.Object) { if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) mask &= ~((uint)PermissionMask.Copy >> 13); @@ -809,7 +809,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (TaskInventoryItem item in m_items.Values) { - if (item.InvType == 6 && (item.CurrentPermissions & 7) != 0) + if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) { if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) item.CurrentPermissions &= ~(uint)PermissionMask.Copy; @@ -840,7 +840,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (TaskInventoryItem item in m_items.Values) { - if (item.InvType == 10) + if (item.InvType == (int)InventoryType.LSL) { return true; } @@ -866,7 +866,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (TaskInventoryItem item in m_items.Values) { - if (item.InvType == 10) + if (item.InvType == (int)InventoryType.LSL) { foreach (IScriptModule e in engines) { @@ -890,7 +890,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (TaskInventoryItem item in m_items.Values) { - if (item.InvType == 10) + if (item.InvType == (int)InventoryType.LSL) { foreach (IScriptModule e in engines) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1cd25e7..e5c59aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1351,8 +1351,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); taskItem.Name = asset.Name; taskItem.Description = asset.Description; - taskItem.Type = 7; - taskItem.InvType = 7; + taskItem.Type = (int)AssetType.Notecard; + taskItem.InvType = (int)InventoryType.Notecard; taskItem.OwnerID = m_host.OwnerID; taskItem.CreatorID = m_host.OwnerID; taskItem.BasePermissions = (uint)PermissionMask.All; -- cgit v1.1