aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-28 17:18:10 +0000
committerJustin Clarke Casey2008-11-28 17:18:10 +0000
commitdf9b0e9e1131cd3fd9b0361d4d75c7242e04d848 (patch)
tree1acbd9fa0ddfaf0784c82651bc4693377d33a0df /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
parent* minor: remove unused JId class (diff)
downloadopensim-SC_OLD-df9b0e9e1131cd3fd9b0361d4d75c7242e04d848.zip
opensim-SC_OLD-df9b0e9e1131cd3fd9b0361d4d75c7242e04d848.tar.gz
opensim-SC_OLD-df9b0e9e1131cd3fd9b0361d4d75c7242e04d848.tar.bz2
opensim-SC_OLD-df9b0e9e1131cd3fd9b0361d4d75c7242e04d848.tar.xz
* refactor: Replace derez destiation magic numbers with an enumeration
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs38
1 files changed, 19 insertions, 19 deletions
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 }