mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
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
This commit is contained in:
@@ -149,9 +149,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
|
||||
parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);
|
||||
|
||||
m_scene.EventManager.OnObjectAddedToScene += EventManagerOnParcelPrimCountAdd;
|
||||
m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
|
||||
m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
|
||||
|
||||
m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
|
||||
m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
|
||||
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
|
||||
|
||||
m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
|
||||
@@ -815,6 +817,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||
}
|
||||
|
||||
if(m_landList.Count == 0 || m_landIDList == null)
|
||||
return null;
|
||||
|
||||
lock (m_landIDList)
|
||||
{
|
||||
try
|
||||
@@ -826,8 +831,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return m_landList[m_landIDList[x / 4, y / 4]];
|
||||
}
|
||||
|
||||
// Create a 'parcel is here' bitmap for the parcel identified by the passed landID
|
||||
@@ -1642,9 +1645,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
|
||||
{
|
||||
List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs);
|
||||
if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2))
|
||||
if (m_scene.Permissions.CanReturnObjects(null, remoteClient, objs2))
|
||||
{
|
||||
m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId);
|
||||
m_scene.returnObjects(objs2.ToArray(), remoteClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2037,7 +2040,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
SceneObjectGroup[] objs = new SceneObjectGroup[1];
|
||||
objs[0] = obj;
|
||||
((Scene)client.Scene).returnObjects(objs, client.AgentId);
|
||||
((Scene)client.Scene).returnObjects(objs, client);
|
||||
}
|
||||
|
||||
Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
|
||||
|
||||
@@ -1664,7 +1664,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
SceneObjectGroup[] objs = new SceneObjectGroup[1];
|
||||
objs[0] = obj;
|
||||
m_scene.returnObjects(objs, obj.OwnerID);
|
||||
m_scene.returnObjects(objs, null);
|
||||
}
|
||||
|
||||
public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
|
||||
@@ -1695,6 +1695,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
if (obj.GroupID == LandData.GroupID)
|
||||
{
|
||||
if (obj.OwnerID == LandData.OwnerID)
|
||||
continue;
|
||||
if (!returns.ContainsKey(obj.OwnerID))
|
||||
returns[obj.OwnerID] =
|
||||
new List<SceneObjectGroup>();
|
||||
@@ -1736,8 +1738,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
foreach (List<SceneObjectGroup> ol in returns.Values)
|
||||
{
|
||||
if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol))
|
||||
m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
|
||||
if (m_scene.Permissions.CanReturnObjects(this, remote_client, ol))
|
||||
m_scene.returnObjects(ol.ToArray(), remote_client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,10 +92,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
|
||||
|
||||
m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
|
||||
m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
|
||||
OnObjectBeingRemovedFromScene;
|
||||
m_Scene.EventManager.OnParcelPrimCountTainted +=
|
||||
OnParcelPrimCountTainted;
|
||||
m_Scene.EventManager.OnObjectBeingRemovedFromScene += OnObjectBeingRemovedFromScene;
|
||||
m_Scene.EventManager.OnParcelPrimCountTainted += OnParcelPrimCountTainted;
|
||||
m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
|
||||
}
|
||||
|
||||
@@ -215,29 +213,15 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
else
|
||||
parcelCounts.Users[obj.OwnerID] = partCount;
|
||||
|
||||
if (obj.IsSelected)
|
||||
{
|
||||
if (obj.IsSelected || obj.GetSittingAvatarsCount() > 0)
|
||||
parcelCounts.Selected += partCount;
|
||||
}
|
||||
|
||||
if (obj.OwnerID == landData.OwnerID)
|
||||
parcelCounts.Owner += partCount;
|
||||
else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
|
||||
parcelCounts.Group += partCount;
|
||||
else
|
||||
{
|
||||
if (landData.IsGroupOwned)
|
||||
{
|
||||
if (obj.OwnerID == landData.GroupID)
|
||||
parcelCounts.Owner += partCount;
|
||||
else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
|
||||
parcelCounts.Group += partCount;
|
||||
else
|
||||
parcelCounts.Others += partCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj.OwnerID == landData.OwnerID)
|
||||
parcelCounts.Owner += partCount;
|
||||
else
|
||||
parcelCounts.Others += partCount;
|
||||
}
|
||||
}
|
||||
parcelCounts.Others += partCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +377,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
count = counts.Owner;
|
||||
count += counts.Group;
|
||||
count += counts.Others;
|
||||
count += counts.Selected;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,9 +282,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
scenePermissions.OnTerraformLand += CanTerraformLand;
|
||||
scenePermissions.OnBuyLand += CanBuyLand;
|
||||
|
||||
scenePermissions.OnReturnObjects += CanReturnObjects;
|
||||
|
||||
scenePermissions.OnRezObject += CanRezObject;
|
||||
scenePermissions.OnObjectEntry += CanObjectEntry;
|
||||
scenePermissions.OnReturnObjects += CanReturnObjects;
|
||||
|
||||
scenePermissions.OnDuplicateObject += CanDuplicateObject;
|
||||
scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
|
||||
@@ -1621,19 +1622,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects)
|
||||
private bool CanReturnObjects(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
ScenePresence sp = m_scene.GetScenePresence(user);
|
||||
if (sp == null)
|
||||
return false;
|
||||
if(sp == null)
|
||||
return true; // assuming that in this case rights are as owner
|
||||
|
||||
bool isPrivUser = sp.IsGod || IsEstateManager(user);
|
||||
UUID userID = sp.UUID;
|
||||
bool isPrivUser = sp.IsGod || IsEstateManager(userID);
|
||||
|
||||
IClientAPI client = sp.ControllingClient;
|
||||
GroupPowers powers;
|
||||
|
||||
ulong powers = 0;
|
||||
ILandObject l;
|
||||
|
||||
foreach (SceneObjectGroup g in new List<SceneObjectGroup>(objects))
|
||||
@@ -1644,7 +1646,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isPrivUser || g.OwnerID == user)
|
||||
if (isPrivUser || g.OwnerID == userID)
|
||||
continue;
|
||||
|
||||
// This is a short cut for efficiency. If land is non-null,
|
||||
@@ -1671,7 +1673,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
LandData ldata = l.LandData;
|
||||
// If we own the land outright, then allow
|
||||
//
|
||||
if (ldata.OwnerID == user)
|
||||
if (ldata.OwnerID == userID)
|
||||
continue;
|
||||
|
||||
// Group voodoo
|
||||
@@ -1679,19 +1681,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
if (ldata.IsGroupOwned)
|
||||
{
|
||||
UUID lGroupID = ldata.GroupID;
|
||||
powers = (GroupPowers)client.GetGroupPowers(lGroupID);
|
||||
// Not a group member, or no rights at all
|
||||
//
|
||||
if (powers == (GroupPowers)0)
|
||||
powers = client.GetGroupPowers(lGroupID);
|
||||
if(powers == 0)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Group deeded object?
|
||||
//
|
||||
if (g.OwnerID == lGroupID &&
|
||||
(powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0)
|
||||
(powers & (ulong)GroupPowers.ReturnGroupOwned) == 0)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
@@ -1700,13 +1702,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
// Group set object?
|
||||
//
|
||||
if (g.GroupID == lGroupID &&
|
||||
(powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0)
|
||||
(powers & (ulong)GroupPowers.ReturnGroupSet) == 0)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((powers & GroupPowers.ReturnNonGroup) == (GroupPowers)0)
|
||||
if ((powers & (ulong)GroupPowers.ReturnNonGroup) == 0)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
|
||||
@@ -105,8 +105,9 @@ namespace OpenSim.Region.CoreModules.World.Vegetation
|
||||
if (rootPart.Shape.PCode != (byte)PCode.Grass)
|
||||
AdaptTree(ref shape);
|
||||
|
||||
m_scene.AddNewSceneObject(sceneObject, true);
|
||||
sceneObject.SetGroup(groupID, null);
|
||||
m_scene.AddNewSceneObject(sceneObject, true);
|
||||
sceneObject.AggregatePerms();
|
||||
|
||||
return sceneObject;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user