aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorUbitUmarov2017-01-27 20:21:24 +0000
committerUbitUmarov2017-01-27 20:21:24 +0000
commit0091c37ed3fd3f9ed4edf079a61f986daadca16b (patch)
tree6e5ca5cb7fa6ae6325d5222b37f39a794a48d345 /OpenSim/Region/CoreModules/World
parentparcels must be loaded before objects, so they can be added to them (diff)
downloadopensim-SC_OLD-0091c37ed3fd3f9ed4edf079a61f986daadca16b.zip
opensim-SC_OLD-0091c37ed3fd3f9ed4edf079a61f986daadca16b.tar.gz
opensim-SC_OLD-0091c37ed3fd3f9ed4edf079a61f986daadca16b.tar.bz2
opensim-SC_OLD-0091c37ed3fd3f9ed4edf079a61f986daadca16b.tar.xz
several changes relative to objects return and parcel prim counts: avoid null refs, report correct count of returned objects, make obkects counts by ownership coerent with return rules, etc
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs3
5 files changed, 42 insertions, 51 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 66be5e5..dfa7095 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -149,9 +149,11 @@ namespace OpenSim.Region.CoreModules.World.Land
149 parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache 149 parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
150 parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0); 150 parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);
151 151
152 m_scene.EventManager.OnObjectAddedToScene += EventManagerOnParcelPrimCountAdd;
152 m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; 153 m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
153 m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; 154
154 m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; 155 m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
156 m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
155 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; 157 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
156 158
157 m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; 159 m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
@@ -815,6 +817,9 @@ namespace OpenSim.Region.CoreModules.World.Land
815 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 817 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
816 } 818 }
817 819
820 if(m_landList.Count == 0 || m_landIDList == null)
821 return null;
822
818 lock (m_landIDList) 823 lock (m_landIDList)
819 { 824 {
820 try 825 try
@@ -826,8 +831,6 @@ namespace OpenSim.Region.CoreModules.World.Land
826 return null; 831 return null;
827 } 832 }
828 } 833 }
829
830 return m_landList[m_landIDList[x / 4, y / 4]];
831 } 834 }
832 835
833 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID 836 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID
@@ -1642,9 +1645,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1642 foreach (HashSet<SceneObjectGroup> objs in returns.Values) 1645 foreach (HashSet<SceneObjectGroup> objs in returns.Values)
1643 { 1646 {
1644 List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs); 1647 List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs);
1645 if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2)) 1648 if (m_scene.Permissions.CanReturnObjects(null, remoteClient, objs2))
1646 { 1649 {
1647 m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId); 1650 m_scene.returnObjects(objs2.ToArray(), remoteClient);
1648 } 1651 }
1649 else 1652 else
1650 { 1653 {
@@ -2037,7 +2040,7 @@ namespace OpenSim.Region.CoreModules.World.Land
2037 { 2040 {
2038 SceneObjectGroup[] objs = new SceneObjectGroup[1]; 2041 SceneObjectGroup[] objs = new SceneObjectGroup[1];
2039 objs[0] = obj; 2042 objs[0] = obj;
2040 ((Scene)client.Scene).returnObjects(objs, client.AgentId); 2043 ((Scene)client.Scene).returnObjects(objs, client);
2041 } 2044 }
2042 2045
2043 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); 2046 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 8c0edc8..9d84e66 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -1664,7 +1664,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1664 { 1664 {
1665 SceneObjectGroup[] objs = new SceneObjectGroup[1]; 1665 SceneObjectGroup[] objs = new SceneObjectGroup[1];
1666 objs[0] = obj; 1666 objs[0] = obj;
1667 m_scene.returnObjects(objs, obj.OwnerID); 1667 m_scene.returnObjects(objs, null);
1668 } 1668 }
1669 1669
1670 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) 1670 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
@@ -1695,6 +1695,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1695 { 1695 {
1696 if (obj.GroupID == LandData.GroupID) 1696 if (obj.GroupID == LandData.GroupID)
1697 { 1697 {
1698 if (obj.OwnerID == LandData.OwnerID)
1699 continue;
1698 if (!returns.ContainsKey(obj.OwnerID)) 1700 if (!returns.ContainsKey(obj.OwnerID))
1699 returns[obj.OwnerID] = 1701 returns[obj.OwnerID] =
1700 new List<SceneObjectGroup>(); 1702 new List<SceneObjectGroup>();
@@ -1736,8 +1738,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1736 1738
1737 foreach (List<SceneObjectGroup> ol in returns.Values) 1739 foreach (List<SceneObjectGroup> ol in returns.Values)
1738 { 1740 {
1739 if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) 1741 if (m_scene.Permissions.CanReturnObjects(this, remote_client, ol))
1740 m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); 1742 m_scene.returnObjects(ol.ToArray(), remote_client);
1741 } 1743 }
1742 } 1744 }
1743 1745
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 857f919..2a720db 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -92,10 +92,8 @@ namespace OpenSim.Region.CoreModules.World.Land
92 m_Scene.RegisterModuleInterface<IPrimCountModule>(this); 92 m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
93 93
94 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; 94 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
95 m_Scene.EventManager.OnObjectBeingRemovedFromScene += 95 m_Scene.EventManager.OnObjectBeingRemovedFromScene += OnObjectBeingRemovedFromScene;
96 OnObjectBeingRemovedFromScene; 96 m_Scene.EventManager.OnParcelPrimCountTainted += OnParcelPrimCountTainted;
97 m_Scene.EventManager.OnParcelPrimCountTainted +=
98 OnParcelPrimCountTainted;
99 m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); }; 97 m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
100 } 98 }
101 99
@@ -215,29 +213,15 @@ namespace OpenSim.Region.CoreModules.World.Land
215 else 213 else
216 parcelCounts.Users[obj.OwnerID] = partCount; 214 parcelCounts.Users[obj.OwnerID] = partCount;
217 215
218 if (obj.IsSelected) 216 if (obj.IsSelected || obj.GetSittingAvatarsCount() > 0)
219 {
220 parcelCounts.Selected += partCount; 217 parcelCounts.Selected += partCount;
221 } 218
219 if (obj.OwnerID == landData.OwnerID)
220 parcelCounts.Owner += partCount;
221 else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
222 parcelCounts.Group += partCount;
222 else 223 else
223 { 224 parcelCounts.Others += partCount;
224 if (landData.IsGroupOwned)
225 {
226 if (obj.OwnerID == landData.GroupID)
227 parcelCounts.Owner += partCount;
228 else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
229 parcelCounts.Group += partCount;
230 else
231 parcelCounts.Others += partCount;
232 }
233 else
234 {
235 if (obj.OwnerID == landData.OwnerID)
236 parcelCounts.Owner += partCount;
237 else
238 parcelCounts.Others += partCount;
239 }
240 }
241 } 225 }
242 } 226 }
243 227
@@ -393,7 +377,6 @@ namespace OpenSim.Region.CoreModules.World.Land
393 count = counts.Owner; 377 count = counts.Owner;
394 count += counts.Group; 378 count += counts.Group;
395 count += counts.Others; 379 count += counts.Others;
396 count += counts.Selected;
397 } 380 }
398 } 381 }
399 382
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index c00112b..279b966 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -282,9 +282,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
282 scenePermissions.OnTerraformLand += CanTerraformLand; 282 scenePermissions.OnTerraformLand += CanTerraformLand;
283 scenePermissions.OnBuyLand += CanBuyLand; 283 scenePermissions.OnBuyLand += CanBuyLand;
284 284
285 scenePermissions.OnReturnObjects += CanReturnObjects;
286
285 scenePermissions.OnRezObject += CanRezObject; 287 scenePermissions.OnRezObject += CanRezObject;
286 scenePermissions.OnObjectEntry += CanObjectEntry; 288 scenePermissions.OnObjectEntry += CanObjectEntry;
287 scenePermissions.OnReturnObjects += CanReturnObjects;
288 289
289 scenePermissions.OnDuplicateObject += CanDuplicateObject; 290 scenePermissions.OnDuplicateObject += CanDuplicateObject;
290 scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs; 291 scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
@@ -1621,19 +1622,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1621 return false; 1622 return false;
1622 } 1623 }
1623 1624
1624 private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) 1625 private bool CanReturnObjects(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects)
1625 { 1626 {
1626 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1627 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1627 if (m_bypassPermissions) return m_bypassPermissionsValue; 1628 if (m_bypassPermissions) return m_bypassPermissionsValue;
1628 1629
1629 ScenePresence sp = m_scene.GetScenePresence(user); 1630 if(sp == null)
1630 if (sp == null) 1631 return true; // assuming that in this case rights are as owner
1631 return false;
1632 1632
1633 bool isPrivUser = sp.IsGod || IsEstateManager(user); 1633 UUID userID = sp.UUID;
1634 bool isPrivUser = sp.IsGod || IsEstateManager(userID);
1634 1635
1635 IClientAPI client = sp.ControllingClient; 1636 IClientAPI client = sp.ControllingClient;
1636 GroupPowers powers; 1637
1638 ulong powers = 0;
1637 ILandObject l; 1639 ILandObject l;
1638 1640
1639 foreach (SceneObjectGroup g in new List<SceneObjectGroup>(objects)) 1641 foreach (SceneObjectGroup g in new List<SceneObjectGroup>(objects))
@@ -1644,7 +1646,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1644 continue; 1646 continue;
1645 } 1647 }
1646 1648
1647 if (isPrivUser || g.OwnerID == user) 1649 if (isPrivUser || g.OwnerID == userID)
1648 continue; 1650 continue;
1649 1651
1650 // This is a short cut for efficiency. If land is non-null, 1652 // This is a short cut for efficiency. If land is non-null,
@@ -1671,7 +1673,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1671 LandData ldata = l.LandData; 1673 LandData ldata = l.LandData;
1672 // If we own the land outright, then allow 1674 // If we own the land outright, then allow
1673 // 1675 //
1674 if (ldata.OwnerID == user) 1676 if (ldata.OwnerID == userID)
1675 continue; 1677 continue;
1676 1678
1677 // Group voodoo 1679 // Group voodoo
@@ -1679,19 +1681,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1679 if (ldata.IsGroupOwned) 1681 if (ldata.IsGroupOwned)
1680 { 1682 {
1681 UUID lGroupID = ldata.GroupID; 1683 UUID lGroupID = ldata.GroupID;
1682 powers = (GroupPowers)client.GetGroupPowers(lGroupID);
1683 // Not a group member, or no rights at all 1684 // Not a group member, or no rights at all
1684 // 1685 //
1685 if (powers == (GroupPowers)0) 1686 powers = client.GetGroupPowers(lGroupID);
1687 if(powers == 0)
1686 { 1688 {
1687 objects.Remove(g); 1689 objects.Remove(g);
1688 continue; 1690 continue;
1689 } 1691 }
1690 1692
1691 // Group deeded object? 1693 // Group deeded object?
1692 // 1694 //
1693 if (g.OwnerID == lGroupID && 1695 if (g.OwnerID == lGroupID &&
1694 (powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0) 1696 (powers & (ulong)GroupPowers.ReturnGroupOwned) == 0)
1695 { 1697 {
1696 objects.Remove(g); 1698 objects.Remove(g);
1697 continue; 1699 continue;
@@ -1700,13 +1702,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1700 // Group set object? 1702 // Group set object?
1701 // 1703 //
1702 if (g.GroupID == lGroupID && 1704 if (g.GroupID == lGroupID &&
1703 (powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0) 1705 (powers & (ulong)GroupPowers.ReturnGroupSet) == 0)
1704 { 1706 {
1705 objects.Remove(g); 1707 objects.Remove(g);
1706 continue; 1708 continue;
1707 } 1709 }
1708 1710
1709 if ((powers & GroupPowers.ReturnNonGroup) == (GroupPowers)0) 1711 if ((powers & (ulong)GroupPowers.ReturnNonGroup) == 0)
1710 { 1712 {
1711 objects.Remove(g); 1713 objects.Remove(g);
1712 continue; 1714 continue;
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index 04b6f00..167f6b5 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -105,8 +105,9 @@ namespace OpenSim.Region.CoreModules.World.Vegetation
105 if (rootPart.Shape.PCode != (byte)PCode.Grass) 105 if (rootPart.Shape.PCode != (byte)PCode.Grass)
106 AdaptTree(ref shape); 106 AdaptTree(ref shape);
107 107
108 m_scene.AddNewSceneObject(sceneObject, true);
109 sceneObject.SetGroup(groupID, null); 108 sceneObject.SetGroup(groupID, null);
109 m_scene.AddNewSceneObject(sceneObject, true);
110 sceneObject.AggregatePerms();
110 111
111 return sceneObject; 112 return sceneObject;
112 } 113 }