From 5573fcfa933bb9c594fb10d9b15477ab7e316b79 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 14 May 2011 00:10:27 +0100 Subject: [PATCH 01/11] Fix adding/removing/replacing outfits in viewer 2 To get this to work, I had to disable the dupe link check I put in a couple of commits ago. When the viewer adds wearables to an existing outfit, it first requests deletes of all the existing links before creating a new set. Since these messages are async, the creates were being received before the deletes had a chance to complete, resulting in missing current outfit links. However, the dupe check shouldn't be as important now that broken links have been fixed - it was the broken links that were causing the client to create dupes. Tested on kokua 0.1.0 WIP and SL 2.6.3. I now have no problems managing outfits on my standalone. --- .../Framework/Scenes/Scene.Inventory.cs | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 3bf2c2b61e..e242010120 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -924,9 +924,9 @@ namespace OpenSim.Region.Framework.Scenes uint callbackID, string description, string name, sbyte invType, sbyte type, UUID olditemID) { - m_log.DebugFormat( - "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", - remoteClient.Name, name, folderID, olditemID); +// m_log.DebugFormat( +// "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", +// remoteClient.Name, name, folderID, olditemID); if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) return; @@ -934,20 +934,25 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence presence; if (TryGetScenePresence(remoteClient.AgentId, out presence)) { - bool linkAlreadyExists = false; - List existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); - foreach (InventoryItemBase item in existingItems) - if (item.AssetID == olditemID) - linkAlreadyExists = true; - - if (linkAlreadyExists) - { - m_log.WarnFormat( - "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", - remoteClient.Name, name, folderID, olditemID); - - return; - } + // Disabled the check for duplicate links. + // + // When outfits are being adjusted, the viewer rapidly sends delete link messages followed by + // create links. However, since these are handled asynchronously, the deletes do not complete before + // the creates are handled. Therefore, we cannot enforce a duplicate link check. +// InventoryItemBase existingLink = null; +// List existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); +// foreach (InventoryItemBase item in existingItems) +// if (item.AssetID == olditemID) +// existingLink = item; +// +// if (existingLink != null) +// { +// m_log.WarnFormat( +// "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link named {4} with id {5} already exists", +// remoteClient.Name, name, folderID, olditemID, existingLink.Name, existingLink.ID); +// +// return; +// } AssetBase asset = new AssetBase(); asset.FullID = olditemID; @@ -975,7 +980,11 @@ namespace OpenSim.Region.Framework.Scenes /// private void RemoveInventoryItem(IClientAPI remoteClient, List itemIDs) { - //m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId); +// m_log.DebugFormat( +// "[AGENT INVENTORY]: Removing inventory items {0} for {1}", +// string.Join(",", itemIDs.ConvertAll(uuid => uuid.ToString()).ToArray()), +// remoteClient.Name); + InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); } From 7a54638b57d7ce4b98cd267ee97b650bdac27b92 Mon Sep 17 00:00:00 2001 From: Makopoppo Date: Sat, 7 May 2011 11:19:01 +0900 Subject: [PATCH 02/11] Swapped the two restart command descriptions each other --- OpenSim/Region/CoreModules/World/Region/RestartModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index e983239b4a..0f37dddc86 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs @@ -70,14 +70,14 @@ namespace OpenSim.Region.CoreModules.World.Region false, "region restart bluebox", "region restart bluebox +", "Schedule a region restart", - "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", + "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", HandleRegionRestart); MainConsole.Instance.Commands.AddCommand("RestartModule", false, "region restart notice", "region restart notice +", "Schedule a region restart", - "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", + "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", HandleRegionRestart); MainConsole.Instance.Commands.AddCommand("RestartModule", From cb6cd3714eb051af23e45c1f4d792d12feb1f4b8 Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Fri, 13 May 2011 09:58:29 +0100 Subject: [PATCH 03/11] The get_grid_info REST call now encodes XML Entities --- OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index cdab49ed6b..0da9fc112a 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -30,6 +30,7 @@ using System.Collections; using System.IO; using System.Net; using System.Reflection; +using System.Security; using System.Text; using log4net; using Nini.Config; @@ -143,7 +144,7 @@ namespace OpenSim.Server.Handlers.Grid sb.Append("\n"); foreach (string k in _info.Keys) { - sb.AppendFormat("<{0}>{1}\n", k, _info[k]); + sb.AppendFormat("<{0}>{1}\n", k, SecurityElement.Escape(_info[k].ToString())); } sb.Append("\n"); From 64d868fb64329b1c961dc8f520c71789bc146609 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 12 May 2011 14:42:28 +0300 Subject: [PATCH 04/11] When loading an OAR that doesn't have parcels, create a default parcel --- .../World/Archiver/ArchiveReadRequest.cs | 11 +++++++---- .../World/Archiver/Tests/ArchiverTests.cs | 2 ++ .../World/Land/LandManagementModule.cs | 19 +++++++++++-------- OpenSim/Tests/Common/Mock/TestLandChannel.cs | 13 +++++++++++-- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 82bef48c8c..64616365f4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -347,12 +347,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver landData.Add(parcel); } - - if (!m_merge) - m_scene.LandChannel.Clear(false); + + if (!m_merge) + { + bool setupDefaultParcel = (landData.Count == 0); + m_scene.LandChannel.Clear(setupDefaultParcel); + } m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); - m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); + m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); } /// diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 2307c8e585..729e9f78bd 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -313,6 +313,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); + Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels"); + // Temporary Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index bfab7b88e4..2eac79d31e 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -668,14 +668,14 @@ namespace OpenSim.Region.CoreModules.World.Land //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); } - + m_landList.Clear(); + + ResetSimLandObjects(); + + if (setupDefaultParcel) + CreateDefaultParcel(); } - - ResetSimLandObjects(); - - if (setupDefaultParcel) - CreateDefaultParcel(); } private void performFinalLandJoin(ILandObject master, ILandObject slave) @@ -1391,8 +1391,11 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnNoLandDataFromStorage() { - ResetSimLandObjects(); - CreateDefaultParcel(); + lock (m_landList) + { + ResetSimLandObjects(); + CreateDefaultParcel(); + } } #endregion diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index c3134b3bc1..0e4dfb9eee 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -40,10 +40,12 @@ namespace OpenSim.Tests.Common.Mock public class TestLandChannel : ILandChannel { private Scene m_scene; + private List m_parcels; public TestLandChannel(Scene scene) { m_scene = scene; + m_parcels = new List(); } public List ParcelsNearPoint(Vector3 position) @@ -53,12 +55,19 @@ namespace OpenSim.Tests.Common.Mock public List AllParcels() { - return new List(); + return m_parcels; } public void Clear(bool setupDefaultParcel) { - // Intentionally blank since we don't save any parcel data in the test channel + m_parcels.Clear(); + + if (setupDefaultParcel) + { + ILandObject obj = new LandObject(UUID.Zero, false, m_scene); + obj.LandData.Name = "Your Parcel"; + m_parcels.Add(obj); + } } protected ILandObject GetNoLand() From 26ce1d27d0f544ebe8fcab672c2e18401067cdd6 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 14 May 2011 01:07:06 +0100 Subject: [PATCH 05/11] Minor doc change to see if this provokes a good panda build --- .../Region/CoreModules/World/Land/LandManagementModule.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 2eac79d31e..63dec1516f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -520,8 +520,12 @@ namespace OpenSim.Region.CoreModules.World.Land } } + /// + /// Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of distance. + /// + /// public void EventManagerOnClientMovement(ScenePresence avatar) - //Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of distance. + // { ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); if (over != null) @@ -534,7 +538,6 @@ namespace OpenSim.Region.CoreModules.World.Land } } - public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client) { From 1d8607914170d285f15b4d48a3ae7a17f56f6aa8 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 14 May 2011 01:26:04 +0100 Subject: [PATCH 06/11] Correct llGetParcelMaxPrims() to use the same calculation as used elsewhere instead of the old 0.22 prims/meter squared fudge factor. Thanks to tglion for this. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aa28fa0ca2..bda46fbca6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9908,8 +9908,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide) { m_host.AddScriptLPS(1); - // Alondria: This currently just is utilizing the normal grid's 0.22 prims/m2 calculation - // Which probably will be irrelevent in OpenSim.... + LandData land = World.GetLandData((float)pos.x, (float)pos.y); float bonusfactor = (float)World.RegionInfo.RegionSettings.ObjectBonus; @@ -9921,16 +9920,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (sim_wide != 0) { - decimal v = land.SimwideArea * (decimal)(0.22) * (decimal)bonusfactor; + int v = (int)((land.SimwideArea / 65536.0f) * (float)World.RegionInfo.ObjectCapacity * bonusfactor); - return (int)v; + return v; } else { - decimal v = land.Area * (decimal)(0.22) * (decimal)bonusfactor; + int v = (int)((land.Area / 65536.0f) * (float)World.RegionInfo.ObjectCapacity * bonusfactor); - return (int)v; + return v; } } From bef1ffa7db3c90f08b3a855e3a5d3d5c7b114549 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 14 May 2011 02:34:46 +0100 Subject: [PATCH 07/11] simplify code in llGetParcelMaxPrims() to use existing code in LandObject rather than duping the algo --- .../Shared/Api/Implementation/LSL_Api.cs | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bda46fbca6..201028337d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9909,29 +9909,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - LandData land = World.GetLandData((float)pos.x, (float)pos.y); + ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); - float bonusfactor = (float)World.RegionInfo.RegionSettings.ObjectBonus; - - if (land == null) - { + if (lo == null) return 0; - } if (sim_wide != 0) - { - int v = (int)((land.SimwideArea / 65536.0f) * (float)World.RegionInfo.ObjectCapacity * bonusfactor); - - return v; - } - + return lo.GetSimulatorMaxPrimCount(lo); else - { - int v = (int)((land.Area / 65536.0f) * (float)World.RegionInfo.ObjectCapacity * bonusfactor); - - return v; - } - + return lo.GetParcelMaxPrimCount(lo); } public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) From 340e3ccf16a59512f86f9c5d08bda3ca8179f53e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 14 May 2011 02:42:47 +0100 Subject: [PATCH 08/11] refactor: remove thisObject argument from ILandObject.Get*MaxPrimCount() instance methods since it didn't make sense to use anything other than the instance themselves. --- OpenSim/Framework/ILandObject.cs | 4 ++-- .../Region/CoreModules/World/Land/LandObject.cs | 15 ++++++++------- .../Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 5a55b02f8e..0316944072 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -35,8 +35,8 @@ namespace OpenSim.Framework public interface ILandObject { - int GetParcelMaxPrimCount(ILandObject thisObject); - int GetSimulatorMaxPrimCount(ILandObject thisObject); + int GetParcelMaxPrimCount(); + int GetSimulatorMaxPrimCount(); int GetPrimsFree(); LandData LandData { get; set; } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index c2f104e370..560b862625 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.World.Land public int GetPrimsFree() { m_scene.EventManager.TriggerParcelPrimCountUpdate(); - int free = GetSimulatorMaxPrimCount(this) - m_landData.SimwidePrims; + int free = GetSimulatorMaxPrimCount() - m_landData.SimwidePrims; return free; } @@ -181,11 +181,11 @@ namespace OpenSim.Region.CoreModules.World.Land overrideSimulatorMaxPrimCount = overrideDel; } - public int GetParcelMaxPrimCount(ILandObject thisObject) + public int GetParcelMaxPrimCount() { if (overrideParcelMaxPrimCount != null) { - return overrideParcelMaxPrimCount(thisObject); + return overrideParcelMaxPrimCount(this); } else { @@ -197,11 +197,12 @@ namespace OpenSim.Region.CoreModules.World.Land return parcelMax; } } - public int GetSimulatorMaxPrimCount(ILandObject thisObject) + + public int GetSimulatorMaxPrimCount() { if (overrideSimulatorMaxPrimCount != null) { - return overrideSimulatorMaxPrimCount(thisObject); + return overrideSimulatorMaxPrimCount(this); } else { @@ -244,8 +245,8 @@ namespace OpenSim.Region.CoreModules.World.Land remote_client.SendLandProperties(seq_id, snap_selection, request_result, this, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, - GetParcelMaxPrimCount(this), - GetSimulatorMaxPrimCount(this), regionFlags); + GetParcelMaxPrimCount(), + GetSimulatorMaxPrimCount(), regionFlags); } public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 201028337d..02402271c1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9915,9 +9915,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; if (sim_wide != 0) - return lo.GetSimulatorMaxPrimCount(lo); + return lo.GetSimulatorMaxPrimCount(); else - return lo.GetParcelMaxPrimCount(lo); + return lo.GetParcelMaxPrimCount(); } public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) From e3b8d42bbc8fe0e85ece55c0a293ecd7a2b55295 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 14 May 2011 02:51:29 +0100 Subject: [PATCH 09/11] refactor: improve PrimLimitsModule to call ILandObject.GetSimulatorMaxPrimCount() rather than use copy/pasted code --- .../PrimLimitsModule/PrimLimitsModule.cs | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 471b90f0e1..c1957e2cb8 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs @@ -76,22 +76,24 @@ namespace OpenSim.Region.OptionalModules public void AddRegion(Scene scene) { - if(!m_enabled) + if (!m_enabled) { return; } scene.Permissions.OnRezObject += CanRezObject; scene.Permissions.OnObjectEntry += CanObjectEnter; scene.Permissions.OnDuplicateObject += CanDuplicateObject; + m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); } public void RemoveRegion(Scene scene) { - if(m_enabled) + if (m_enabled) { return; } + scene.Permissions.OnRezObject -= CanRezObject; scene.Permissions.OnObjectEntry -= CanObjectEnter; scene.Permissions.OnDuplicateObject -= CanDuplicateObject; @@ -104,13 +106,11 @@ namespace OpenSim.Region.OptionalModules private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) { - // This may be a little long winded and can probably be optomized - int usedPrims = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).PrimCounts.Total; - LandData landData = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).LandData; - int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * - (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); + ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); + int usedPrims = lo.PrimCounts.Total; + int simulatorCapacity = lo.GetSimulatorMaxPrimCount(); - if(objectCount + usedPrims > simulatorCapacity) + if (objectCount + usedPrims > simulatorCapacity) { m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); return false; @@ -118,7 +118,7 @@ namespace OpenSim.Region.OptionalModules return true; } - //OnMoveObject + private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) { SceneObjectPart obj = scene.GetSceneObjectPart(objectID); @@ -126,11 +126,9 @@ namespace OpenSim.Region.OptionalModules int objectCount = obj.ParentGroup.PrimCount; ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); - - int usedPrims=newParcel.PrimCounts.Total; - LandData landData = newParcel.LandData; - int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * - (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); + + int usedPrims = newParcel.PrimCounts.Total; + int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); // The prim hasn't crossed a region boundry so we don't need to worry // about prim counts here @@ -138,36 +136,39 @@ namespace OpenSim.Region.OptionalModules { return true; } + // Prim counts are determined by the location of the root prim. if we're // moving a child prim, just let it pass if(!obj.IsRoot) { return true; } - // Add Special Case here for temporary prims + + // TODO: Add Special Case here for temporary prims if(objectCount + usedPrims > simulatorCapacity) { m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); return false; } + return true; } + //OnDuplicateObject private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition) { - // This may be a little long winded and can probably be optomized - int usedPrims = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).PrimCounts.Total; - LandData landData = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).LandData; - int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * - (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); + ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); + int usedPrims = lo.PrimCounts.Total; + int simulatorCapacity = lo.GetSimulatorMaxPrimCount(); if(objectCount + usedPrims > simulatorCapacity) { m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); return false; } + return true; } } -} +} \ No newline at end of file From a3aa839d751b04f1898b728fc9b8bc9e65352b21 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 14 May 2011 12:56:50 -0700 Subject: [PATCH 10/11] Stop spamming Nebadon's console when assets aren't found in the asset server. --- OpenSim/Framework/WebUtil.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 27a646aad1..5628376702 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -979,8 +979,11 @@ namespace OpenSim.Framework try { - using (WebResponse resp = request.GetResponse()) + using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse()) { + if (resp.StatusCode == HttpStatusCode.NotFound) + return deserial; + if (resp.ContentLength != 0) { Stream respStream = resp.GetResponseStream(); From be6feff331a97b1e976ca52aa0012f24c837e5d6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 14 May 2011 13:09:59 -0700 Subject: [PATCH 11/11] Also changed a couple of messages in WebUtil from Wanr/Info to Debug. --- OpenSim/Framework/WebUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 5628376702..93236078b0 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -251,11 +251,11 @@ namespace OpenSim.Framework // This just dumps a warning for any operation that takes more than 100 ms int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) - m_log.InfoFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", + m_log.DebugFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", reqnum,url,method,tickdiff,tickdata); } - m_log.WarnFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); + m_log.DebugFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); return ErrorResponseMap(errorMessage); }