diff options
author | Justin Clarke Casey | 2008-11-28 17:18:10 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-28 17:18:10 +0000 |
commit | df9b0e9e1131cd3fd9b0361d4d75c7242e04d848 (patch) | |
tree | 1acbd9fa0ddfaf0784c82651bc4693377d33a0df /OpenSim/Region/Environment | |
parent | * minor: remove unused JId class (diff) | |
download | opensim-SC-df9b0e9e1131cd3fd9b0361d4d75c7242e04d848.zip opensim-SC-df9b0e9e1131cd3fd9b0361d4d75c7242e04d848.tar.gz opensim-SC-df9b0e9e1131cd3fd9b0361d4d75c7242e04d848.tar.bz2 opensim-SC-df9b0e9e1131cd3fd9b0361d4d75c7242e04d848.tar.xz |
* refactor: Replace derez destiation magic numbers with an enumeration
Diffstat (limited to '')
5 files changed, 29 insertions, 29 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs index 20cf318..03b3977 100644 --- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
38 | { | 38 | { |
39 | class DeleteToInventoryHolder | 39 | class DeleteToInventoryHolder |
40 | { | 40 | { |
41 | public int destination; | 41 | public DeRezAction action; |
42 | public IClientAPI remoteClient; | 42 | public IClientAPI remoteClient; |
43 | public SceneObjectGroup objectGroup; | 43 | public SceneObjectGroup objectGroup; |
44 | public UUID folderID; | 44 | public UUID folderID; |
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Delete the given object from the scene | 75 | /// Delete the given object from the scene |
76 | /// </summary> | 76 | /// </summary> |
77 | public void DeleteToInventory(int destination, UUID folderID, | 77 | public void DeleteToInventory(DeRezAction action, UUID folderID, |
78 | SceneObjectGroup objectGroup, IClientAPI remoteClient, | 78 | SceneObjectGroup objectGroup, IClientAPI remoteClient, |
79 | bool permissionToDelete) | 79 | bool permissionToDelete) |
80 | { | 80 | { |
@@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
84 | lock (m_inventoryDeletes) | 84 | lock (m_inventoryDeletes) |
85 | { | 85 | { |
86 | DeleteToInventoryHolder dtis = new DeleteToInventoryHolder(); | 86 | DeleteToInventoryHolder dtis = new DeleteToInventoryHolder(); |
87 | dtis.destination = destination; | 87 | dtis.action = action; |
88 | dtis.folderID = folderID; | 88 | dtis.folderID = folderID; |
89 | dtis.objectGroup = objectGroup; | 89 | dtis.objectGroup = objectGroup; |
90 | dtis.remoteClient = remoteClient; | 90 | dtis.remoteClient = remoteClient; |
@@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
136 | 136 | ||
137 | try | 137 | try |
138 | { | 138 | { |
139 | m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient); | 139 | m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); |
140 | if (x.permissionToDelete) | 140 | if (x.permissionToDelete) |
141 | m_scene.DeleteSceneObject(x.objectGroup, false); | 141 | m_scene.DeleteSceneObject(x.objectGroup, false); |
142 | } | 142 | } |
@@ -149,7 +149,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
149 | } | 149 | } |
150 | } | 150 | } |
151 | } | 151 | } |
152 | catch(Exception e) | 152 | catch (Exception e) |
153 | { | 153 | { |
154 | // We can't put the object group details in here since the root part may have disappeared (which is where these sit). | 154 | // We can't put the object group details in here since the root part may have disappeared (which is where these sit). |
155 | // FIXME: This needs to be fixed. | 155 | // FIXME: This needs to be fixed. |
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs index 92627d1..f44ba30 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs | |||
@@ -102,9 +102,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid | |||
102 | /// | 102 | /// |
103 | /// DeleteToInventory | 103 | /// DeleteToInventory |
104 | /// | 104 | /// |
105 | public override UUID DeleteToInventory(int destination, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) | 105 | public override UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) |
106 | { | 106 | { |
107 | UUID assetID = base.DeleteToInventory(destination, folderID, objectGroup, remoteClient); | 107 | UUID assetID = base.DeleteToInventory(action, folderID, objectGroup, remoteClient); |
108 | 108 | ||
109 | if (!assetID.Equals(UUID.Zero)) | 109 | if (!assetID.Equals(UUID.Zero)) |
110 | { | 110 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 77ac121..113b16c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
43 | public partial class Scene | 43 | public partial class Scene |
44 | { | 44 | { |
45 | private static readonly ILog m_log | 45 | private static readonly ILog m_log |
46 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// Allows asynchronous derezzing of objects from the scene into a client's inventory. | 49 | /// Allows asynchronous derezzing of objects from the scene into a client's inventory. |
@@ -1543,10 +1543,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1543 | /// <summary> | 1543 | /// <summary> |
1544 | /// Called when an object is removed from the environment into inventory. | 1544 | /// Called when an object is removed from the environment into inventory. |
1545 | /// </summary> | 1545 | /// </summary> |
1546 | /// <param name="packet"></param> | ||
1547 | /// <param name="remoteClient"></param> | 1546 | /// <param name="remoteClient"></param> |
1547 | /// <param name="localID"></param> | ||
1548 | /// <param name="groupID"></param> | ||
1549 | /// <param name="action"></param> | ||
1550 | /// <param name="destinationID"></param> | ||
1548 | public virtual void DeRezObject(IClientAPI remoteClient, uint localID, | 1551 | public virtual void DeRezObject(IClientAPI remoteClient, uint localID, |
1549 | UUID groupID, byte destination, UUID destinationID) | 1552 | UUID groupID, DeRezAction action, UUID destinationID) |
1550 | { | 1553 | { |
1551 | SceneObjectPart part = GetSceneObjectPart(localID); | 1554 | SceneObjectPart part = GetSceneObjectPart(localID); |
1552 | if (part == null) | 1555 | if (part == null) |
@@ -1564,20 +1567,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1564 | bool permissionToTake = false; | 1567 | bool permissionToTake = false; |
1565 | bool permissionToDelete = false; | 1568 | bool permissionToDelete = false; |
1566 | 1569 | ||
1567 | if (destination == 1) // Take Copy | 1570 | if (action == DeRezAction.TakeCopy) |
1568 | { | 1571 | { |
1569 | permissionToTake = | 1572 | permissionToTake = |
1570 | Permissions.CanTakeCopyObject( | 1573 | Permissions.CanTakeCopyObject( |
1571 | grp.UUID, | 1574 | grp.UUID, |
1572 | remoteClient.AgentId); | 1575 | remoteClient.AgentId); |
1573 | } | 1576 | } |
1574 | else if (destination == 5) // God take copy | 1577 | else if (action == DeRezAction.GodTakeCopy) |
1575 | { | 1578 | { |
1576 | permissionToTake = | 1579 | permissionToTake = |
1577 | Permissions.IsGod( | 1580 | Permissions.IsGod( |
1578 | remoteClient.AgentId); | 1581 | remoteClient.AgentId); |
1579 | } | 1582 | } |
1580 | else if (destination == 4) // Take | 1583 | else if (action == DeRezAction.Take) |
1581 | { | 1584 | { |
1582 | permissionToTake = | 1585 | permissionToTake = |
1583 | Permissions.CanTakeObject( | 1586 | Permissions.CanTakeObject( |
@@ -1587,7 +1590,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1587 | //If they can take, they can delete! | 1590 | //If they can take, they can delete! |
1588 | permissionToDelete = permissionToTake; | 1591 | permissionToDelete = permissionToTake; |
1589 | } | 1592 | } |
1590 | else if (destination == 6) //Delete | 1593 | else if (action == DeRezAction.Delete) |
1591 | { | 1594 | { |
1592 | permissionToTake = | 1595 | permissionToTake = |
1593 | Permissions.CanDeleteObject( | 1596 | Permissions.CanDeleteObject( |
@@ -1598,7 +1601,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1598 | grp.UUID, | 1601 | grp.UUID, |
1599 | remoteClient.AgentId); | 1602 | remoteClient.AgentId); |
1600 | } | 1603 | } |
1601 | else if (destination == 9) //Return | 1604 | else if (action == DeRezAction.Return) |
1602 | { | 1605 | { |
1603 | if (remoteClient != null) | 1606 | if (remoteClient != null) |
1604 | { | 1607 | { |
@@ -1625,7 +1628,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1625 | if (permissionToTake) | 1628 | if (permissionToTake) |
1626 | { | 1629 | { |
1627 | m_asyncSceneObjectDeleter.DeleteToInventory( | 1630 | m_asyncSceneObjectDeleter.DeleteToInventory( |
1628 | destination, destinationID, grp, remoteClient, | 1631 | action, destinationID, grp, remoteClient, |
1629 | permissionToDelete); | 1632 | permissionToDelete); |
1630 | } | 1633 | } |
1631 | else if (permissionToDelete) | 1634 | else if (permissionToDelete) |
@@ -1638,13 +1641,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1638 | /// Delete a scene object from a scene and place in the given avatar's inventory. | 1641 | /// Delete a scene object from a scene and place in the given avatar's inventory. |
1639 | /// Returns the UUID of the newly created asset. | 1642 | /// Returns the UUID of the newly created asset. |
1640 | /// </summary> | 1643 | /// </summary> |
1641 | /// <param name="DeRezPacket"></param> | 1644 | /// <param name="action"></param> |
1642 | /// <param name="selectedEnt"></param> | ||
1643 | /// <param name="remoteClient"> </param> | ||
1644 | /// <param name="objectGroup"></param> | ||
1645 | /// <param name="folderID"></param> | 1645 | /// <param name="folderID"></param> |
1646 | /// <param name="permissionToDelete"></param> | 1646 | /// <param name="objectGroup"></param> |
1647 | public virtual UUID DeleteToInventory(int destination, UUID folderID, | 1647 | /// <param name="remoteClient"> </param> |
1648 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | ||
1648 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | 1649 | SceneObjectGroup objectGroup, IClientAPI remoteClient) |
1649 | { | 1650 | { |
1650 | UUID assetID = UUID.Zero; | 1651 | UUID assetID = UUID.Zero; |
@@ -1671,7 +1672,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1671 | // If we're returning someone's item, it goes back to the | 1672 | // If we're returning someone's item, it goes back to the |
1672 | // owner's Lost And Found folder. | 1673 | // owner's Lost And Found folder. |
1673 | 1674 | ||
1674 | if (folderID == UUID.Zero || (destination == 6 && | 1675 | if (folderID == UUID.Zero || (action == DeRezAction.Delete && |
1675 | objectGroup.OwnerID != remoteClient.AgentId)) | 1676 | objectGroup.OwnerID != remoteClient.AgentId)) |
1676 | { | 1677 | { |
1677 | InventoryFolderBase folder = | 1678 | InventoryFolderBase folder = |
@@ -1708,8 +1709,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1708 | InventoryItemBase item = new InventoryItemBase(); | 1709 | InventoryItemBase item = new InventoryItemBase(); |
1709 | item.Creator = objectGroup.RootPart.CreatorID; | 1710 | item.Creator = objectGroup.RootPart.CreatorID; |
1710 | 1711 | ||
1711 | if (destination == 1 || | 1712 | if (action == DeRezAction.TakeCopy || action == DeRezAction.Take) |
1712 | destination == 4)// Take / Copy | ||
1713 | item.Owner = remoteClient.AgentId; | 1713 | item.Owner = remoteClient.AgentId; |
1714 | else // Delete / Return | 1714 | else // Delete / Return |
1715 | item.Owner = objectGroup.OwnerID; | 1715 | item.Owner = objectGroup.OwnerID; |
@@ -2215,7 +2215,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2215 | { | 2215 | { |
2216 | AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | 2216 | AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); |
2217 | DeRezObject(null, grp.RootPart.LocalId, | 2217 | DeRezObject(null, grp.RootPart.LocalId, |
2218 | grp.RootPart.GroupID, 9, UUID.Zero); | 2218 | grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero); |
2219 | } | 2219 | } |
2220 | return true; | 2220 | return true; |
2221 | } | 2221 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 7bdcb5c..8a6f06c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1223,10 +1223,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1223 | parcel.landData.OtherCleanTime) | 1223 | parcel.landData.OtherCleanTime) |
1224 | { | 1224 | { |
1225 | DetachFromBackup(); | 1225 | DetachFromBackup(); |
1226 | m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); | 1226 | m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); |
1227 | m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); | 1227 | m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); |
1228 | m_scene.DeRezObject(null, RootPart.LocalId, | 1228 | m_scene.DeRezObject(null, RootPart.LocalId, |
1229 | RootPart.GroupID, 9, UUID.Zero); | 1229 | RootPart.GroupID, DeRezAction.Return, UUID.Zero); |
1230 | 1230 | ||
1231 | return; | 1231 | return; |
1232 | } | 1232 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index 7391696..babdee6 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
110 | Is.EqualTo(agentId)); | 110 | Is.EqualTo(agentId)); |
111 | 111 | ||
112 | IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); | 112 | IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); |
113 | scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero); | 113 | scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Return, UUID.Zero); |
114 | 114 | ||
115 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 115 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
116 | Assert.That(retrievedPart, Is.Not.Null); | 116 | Assert.That(retrievedPart, Is.Not.Null); |