diff options
author | Diva Canto | 2011-05-14 12:57:34 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-14 12:57:34 -0700 |
commit | 082a9ecd31d953fd415b515df4f67078a786f8d5 (patch) | |
tree | 0ea0bf15d6a46120b69803630141141eb477c995 /OpenSim | |
parent | Stop spamming Nebadon's console when assets aren't found in the asset server. (diff) | |
parent | refactor: improve PrimLimitsModule to call ILandObject.GetSimulatorMaxPrimCou... (diff) | |
download | opensim-SC-082a9ecd31d953fd415b515df4f67078a786f8d5.zip opensim-SC-082a9ecd31d953fd415b515df4f67078a786f8d5.tar.gz opensim-SC-082a9ecd31d953fd415b515df4f67078a786f8d5.tar.bz2 opensim-SC-082a9ecd31d953fd415b515df4f67078a786f8d5.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
11 files changed, 103 insertions, 86 deletions
diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 5a55b02..0316944 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs | |||
@@ -35,8 +35,8 @@ namespace OpenSim.Framework | |||
35 | 35 | ||
36 | public interface ILandObject | 36 | public interface ILandObject |
37 | { | 37 | { |
38 | int GetParcelMaxPrimCount(ILandObject thisObject); | 38 | int GetParcelMaxPrimCount(); |
39 | int GetSimulatorMaxPrimCount(ILandObject thisObject); | 39 | int GetSimulatorMaxPrimCount(); |
40 | int GetPrimsFree(); | 40 | int GetPrimsFree(); |
41 | 41 | ||
42 | LandData LandData { get; set; } | 42 | LandData LandData { get; set; } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 82bef48..6461636 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 | |||
347 | 347 | ||
348 | landData.Add(parcel); | 348 | landData.Add(parcel); |
349 | } | 349 | } |
350 | 350 | ||
351 | if (!m_merge) | 351 | if (!m_merge) |
352 | m_scene.LandChannel.Clear(false); | 352 | { |
353 | bool setupDefaultParcel = (landData.Count == 0); | ||
354 | m_scene.LandChannel.Clear(setupDefaultParcel); | ||
355 | } | ||
353 | 356 | ||
354 | m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); | 357 | m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); |
355 | m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); | 358 | m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); |
356 | } | 359 | } |
357 | 360 | ||
358 | /// <summary> | 361 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 2307c8e..729e9f7 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 | |||
313 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); | 313 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); |
314 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); | 314 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); |
315 | 315 | ||
316 | Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels"); | ||
317 | |||
316 | // Temporary | 318 | // Temporary |
317 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | 319 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); |
318 | } | 320 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index bfab7b8..63dec15 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 | |||
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
523 | /// <summary> | ||
524 | /// Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of distance. | ||
525 | /// </summary> | ||
526 | /// <param name="avatar"></param> | ||
523 | public void EventManagerOnClientMovement(ScenePresence avatar) | 527 | public void EventManagerOnClientMovement(ScenePresence avatar) |
524 | //Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of distance. | 528 | // |
525 | { | 529 | { |
526 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 530 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
527 | if (over != null) | 531 | if (over != null) |
@@ -534,7 +538,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
534 | } | 538 | } |
535 | } | 539 | } |
536 | 540 | ||
537 | |||
538 | public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID, | 541 | public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID, |
539 | int landLocalID, IClientAPI remote_client) | 542 | int landLocalID, IClientAPI remote_client) |
540 | { | 543 | { |
@@ -668,14 +671,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
668 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); | 671 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); |
669 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); | 672 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); |
670 | } | 673 | } |
671 | 674 | ||
672 | m_landList.Clear(); | 675 | m_landList.Clear(); |
676 | |||
677 | ResetSimLandObjects(); | ||
678 | |||
679 | if (setupDefaultParcel) | ||
680 | CreateDefaultParcel(); | ||
673 | } | 681 | } |
674 | |||
675 | ResetSimLandObjects(); | ||
676 | |||
677 | if (setupDefaultParcel) | ||
678 | CreateDefaultParcel(); | ||
679 | } | 682 | } |
680 | 683 | ||
681 | private void performFinalLandJoin(ILandObject master, ILandObject slave) | 684 | private void performFinalLandJoin(ILandObject master, ILandObject slave) |
@@ -1391,8 +1394,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1391 | 1394 | ||
1392 | public void EventManagerOnNoLandDataFromStorage() | 1395 | public void EventManagerOnNoLandDataFromStorage() |
1393 | { | 1396 | { |
1394 | ResetSimLandObjects(); | 1397 | lock (m_landList) |
1395 | CreateDefaultParcel(); | 1398 | { |
1399 | ResetSimLandObjects(); | ||
1400 | CreateDefaultParcel(); | ||
1401 | } | ||
1396 | } | 1402 | } |
1397 | 1403 | ||
1398 | #endregion | 1404 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index c2f104e..560b862 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 | |||
67 | public int GetPrimsFree() | 67 | public int GetPrimsFree() |
68 | { | 68 | { |
69 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 69 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
70 | int free = GetSimulatorMaxPrimCount(this) - m_landData.SimwidePrims; | 70 | int free = GetSimulatorMaxPrimCount() - m_landData.SimwidePrims; |
71 | return free; | 71 | return free; |
72 | } | 72 | } |
73 | 73 | ||
@@ -181,11 +181,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
181 | overrideSimulatorMaxPrimCount = overrideDel; | 181 | overrideSimulatorMaxPrimCount = overrideDel; |
182 | } | 182 | } |
183 | 183 | ||
184 | public int GetParcelMaxPrimCount(ILandObject thisObject) | 184 | public int GetParcelMaxPrimCount() |
185 | { | 185 | { |
186 | if (overrideParcelMaxPrimCount != null) | 186 | if (overrideParcelMaxPrimCount != null) |
187 | { | 187 | { |
188 | return overrideParcelMaxPrimCount(thisObject); | 188 | return overrideParcelMaxPrimCount(this); |
189 | } | 189 | } |
190 | else | 190 | else |
191 | { | 191 | { |
@@ -197,11 +197,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
197 | return parcelMax; | 197 | return parcelMax; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | public int GetSimulatorMaxPrimCount(ILandObject thisObject) | 200 | |
201 | public int GetSimulatorMaxPrimCount() | ||
201 | { | 202 | { |
202 | if (overrideSimulatorMaxPrimCount != null) | 203 | if (overrideSimulatorMaxPrimCount != null) |
203 | { | 204 | { |
204 | return overrideSimulatorMaxPrimCount(thisObject); | 205 | return overrideSimulatorMaxPrimCount(this); |
205 | } | 206 | } |
206 | else | 207 | else |
207 | { | 208 | { |
@@ -244,8 +245,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
244 | remote_client.SendLandProperties(seq_id, | 245 | remote_client.SendLandProperties(seq_id, |
245 | snap_selection, request_result, this, | 246 | snap_selection, request_result, this, |
246 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 247 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
247 | GetParcelMaxPrimCount(this), | 248 | GetParcelMaxPrimCount(), |
248 | GetSimulatorMaxPrimCount(this), regionFlags); | 249 | GetSimulatorMaxPrimCount(), regionFlags); |
249 | } | 250 | } |
250 | 251 | ||
251 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) | 252 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index e983239..0f37ddd 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 | |||
70 | false, "region restart bluebox", | 70 | false, "region restart bluebox", |
71 | "region restart bluebox <message> <delta seconds>+", | 71 | "region restart bluebox <message> <delta seconds>+", |
72 | "Schedule a region restart", | 72 | "Schedule a region restart", |
73 | "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.", | 73 | "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.", |
74 | HandleRegionRestart); | 74 | HandleRegionRestart); |
75 | 75 | ||
76 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 76 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
77 | false, "region restart notice", | 77 | false, "region restart notice", |
78 | "region restart notice <message> <delta seconds>+", | 78 | "region restart notice <message> <delta seconds>+", |
79 | "Schedule a region restart", | 79 | "Schedule a region restart", |
80 | "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.", | 80 | "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.", |
81 | HandleRegionRestart); | 81 | HandleRegionRestart); |
82 | 82 | ||
83 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 83 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 3bf2c2b..e2420101 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 | |||
924 | uint callbackID, string description, string name, | 924 | uint callbackID, string description, string name, |
925 | sbyte invType, sbyte type, UUID olditemID) | 925 | sbyte invType, sbyte type, UUID olditemID) |
926 | { | 926 | { |
927 | m_log.DebugFormat( | 927 | // m_log.DebugFormat( |
928 | "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", | 928 | // "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", |
929 | remoteClient.Name, name, folderID, olditemID); | 929 | // remoteClient.Name, name, folderID, olditemID); |
930 | 930 | ||
931 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 931 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
932 | return; | 932 | return; |
@@ -934,20 +934,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
934 | ScenePresence presence; | 934 | ScenePresence presence; |
935 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | 935 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) |
936 | { | 936 | { |
937 | bool linkAlreadyExists = false; | 937 | // Disabled the check for duplicate links. |
938 | List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); | 938 | // |
939 | foreach (InventoryItemBase item in existingItems) | 939 | // When outfits are being adjusted, the viewer rapidly sends delete link messages followed by |
940 | if (item.AssetID == olditemID) | 940 | // create links. However, since these are handled asynchronously, the deletes do not complete before |
941 | linkAlreadyExists = true; | 941 | // the creates are handled. Therefore, we cannot enforce a duplicate link check. |
942 | 942 | // InventoryItemBase existingLink = null; | |
943 | if (linkAlreadyExists) | 943 | // List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); |
944 | { | 944 | // foreach (InventoryItemBase item in existingItems) |
945 | m_log.WarnFormat( | 945 | // if (item.AssetID == olditemID) |
946 | "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", | 946 | // existingLink = item; |
947 | remoteClient.Name, name, folderID, olditemID); | 947 | // |
948 | 948 | // if (existingLink != null) | |
949 | return; | 949 | // { |
950 | } | 950 | // m_log.WarnFormat( |
951 | // "[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", | ||
952 | // remoteClient.Name, name, folderID, olditemID, existingLink.Name, existingLink.ID); | ||
953 | // | ||
954 | // return; | ||
955 | // } | ||
951 | 956 | ||
952 | AssetBase asset = new AssetBase(); | 957 | AssetBase asset = new AssetBase(); |
953 | asset.FullID = olditemID; | 958 | asset.FullID = olditemID; |
@@ -975,7 +980,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
975 | /// <param name="itemID"></param> | 980 | /// <param name="itemID"></param> |
976 | private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs) | 981 | private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs) |
977 | { | 982 | { |
978 | //m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId); | 983 | // m_log.DebugFormat( |
984 | // "[AGENT INVENTORY]: Removing inventory items {0} for {1}", | ||
985 | // string.Join(",", itemIDs.ConvertAll<string>(uuid => uuid.ToString()).ToArray()), | ||
986 | // remoteClient.Name); | ||
987 | |||
979 | InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); | 988 | InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); |
980 | } | 989 | } |
981 | 990 | ||
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 471b90f..c1957e2 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | |||
@@ -76,22 +76,24 @@ namespace OpenSim.Region.OptionalModules | |||
76 | 76 | ||
77 | public void AddRegion(Scene scene) | 77 | public void AddRegion(Scene scene) |
78 | { | 78 | { |
79 | if(!m_enabled) | 79 | if (!m_enabled) |
80 | { | 80 | { |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | scene.Permissions.OnRezObject += CanRezObject; | 83 | scene.Permissions.OnRezObject += CanRezObject; |
84 | scene.Permissions.OnObjectEntry += CanObjectEnter; | 84 | scene.Permissions.OnObjectEntry += CanObjectEnter; |
85 | scene.Permissions.OnDuplicateObject += CanDuplicateObject; | 85 | scene.Permissions.OnDuplicateObject += CanDuplicateObject; |
86 | |||
86 | m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); | 87 | m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); |
87 | } | 88 | } |
88 | 89 | ||
89 | public void RemoveRegion(Scene scene) | 90 | public void RemoveRegion(Scene scene) |
90 | { | 91 | { |
91 | if(m_enabled) | 92 | if (m_enabled) |
92 | { | 93 | { |
93 | return; | 94 | return; |
94 | } | 95 | } |
96 | |||
95 | scene.Permissions.OnRezObject -= CanRezObject; | 97 | scene.Permissions.OnRezObject -= CanRezObject; |
96 | scene.Permissions.OnObjectEntry -= CanObjectEnter; | 98 | scene.Permissions.OnObjectEntry -= CanObjectEnter; |
97 | scene.Permissions.OnDuplicateObject -= CanDuplicateObject; | 99 | scene.Permissions.OnDuplicateObject -= CanDuplicateObject; |
@@ -104,13 +106,11 @@ namespace OpenSim.Region.OptionalModules | |||
104 | 106 | ||
105 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) | 107 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) |
106 | { | 108 | { |
107 | // This may be a little long winded and can probably be optomized | 109 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
108 | int usedPrims = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).PrimCounts.Total; | 110 | int usedPrims = lo.PrimCounts.Total; |
109 | LandData landData = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).LandData; | 111 | int simulatorCapacity = lo.GetSimulatorMaxPrimCount(); |
110 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * | ||
111 | (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); | ||
112 | 112 | ||
113 | if(objectCount + usedPrims > simulatorCapacity) | 113 | if (objectCount + usedPrims > simulatorCapacity) |
114 | { | 114 | { |
115 | m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); | 115 | m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); |
116 | return false; | 116 | return false; |
@@ -118,7 +118,7 @@ namespace OpenSim.Region.OptionalModules | |||
118 | 118 | ||
119 | return true; | 119 | return true; |
120 | } | 120 | } |
121 | //OnMoveObject | 121 | |
122 | private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) | 122 | private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) |
123 | { | 123 | { |
124 | SceneObjectPart obj = scene.GetSceneObjectPart(objectID); | 124 | SceneObjectPart obj = scene.GetSceneObjectPart(objectID); |
@@ -126,11 +126,9 @@ namespace OpenSim.Region.OptionalModules | |||
126 | int objectCount = obj.ParentGroup.PrimCount; | 126 | int objectCount = obj.ParentGroup.PrimCount; |
127 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); | 127 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); |
128 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); | 128 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); |
129 | 129 | ||
130 | int usedPrims=newParcel.PrimCounts.Total; | 130 | int usedPrims = newParcel.PrimCounts.Total; |
131 | LandData landData = newParcel.LandData; | 131 | int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); |
132 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * | ||
133 | (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); | ||
134 | 132 | ||
135 | // The prim hasn't crossed a region boundry so we don't need to worry | 133 | // The prim hasn't crossed a region boundry so we don't need to worry |
136 | // about prim counts here | 134 | // about prim counts here |
@@ -138,36 +136,39 @@ namespace OpenSim.Region.OptionalModules | |||
138 | { | 136 | { |
139 | return true; | 137 | return true; |
140 | } | 138 | } |
139 | |||
141 | // Prim counts are determined by the location of the root prim. if we're | 140 | // Prim counts are determined by the location of the root prim. if we're |
142 | // moving a child prim, just let it pass | 141 | // moving a child prim, just let it pass |
143 | if(!obj.IsRoot) | 142 | if(!obj.IsRoot) |
144 | { | 143 | { |
145 | return true; | 144 | return true; |
146 | } | 145 | } |
147 | // Add Special Case here for temporary prims | 146 | |
147 | // TODO: Add Special Case here for temporary prims | ||
148 | 148 | ||
149 | if(objectCount + usedPrims > simulatorCapacity) | 149 | if(objectCount + usedPrims > simulatorCapacity) |
150 | { | 150 | { |
151 | m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); | 151 | m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); |
152 | return false; | 152 | return false; |
153 | } | 153 | } |
154 | |||
154 | return true; | 155 | return true; |
155 | } | 156 | } |
157 | |||
156 | //OnDuplicateObject | 158 | //OnDuplicateObject |
157 | private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition) | 159 | private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition) |
158 | { | 160 | { |
159 | // This may be a little long winded and can probably be optomized | 161 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
160 | int usedPrims = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).PrimCounts.Total; | 162 | int usedPrims = lo.PrimCounts.Total; |
161 | LandData landData = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).LandData; | 163 | int simulatorCapacity = lo.GetSimulatorMaxPrimCount(); |
162 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * | ||
163 | (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); | ||
164 | 164 | ||
165 | if(objectCount + usedPrims > simulatorCapacity) | 165 | if(objectCount + usedPrims > simulatorCapacity) |
166 | { | 166 | { |
167 | m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); | 167 | m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); |
168 | return false; | 168 | return false; |
169 | } | 169 | } |
170 | |||
170 | return true; | 171 | return true; |
171 | } | 172 | } |
172 | } | 173 | } |
173 | } | 174 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aa28fa0..0240227 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -9908,31 +9908,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9908 | public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide) | 9908 | public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide) |
9909 | { | 9909 | { |
9910 | m_host.AddScriptLPS(1); | 9910 | m_host.AddScriptLPS(1); |
9911 | // Alondria: This currently just is utilizing the normal grid's 0.22 prims/m2 calculation | ||
9912 | // Which probably will be irrelevent in OpenSim.... | ||
9913 | LandData land = World.GetLandData((float)pos.x, (float)pos.y); | ||
9914 | 9911 | ||
9915 | float bonusfactor = (float)World.RegionInfo.RegionSettings.ObjectBonus; | 9912 | ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); |
9916 | 9913 | ||
9917 | if (land == null) | 9914 | if (lo == null) |
9918 | { | ||
9919 | return 0; | 9915 | return 0; |
9920 | } | ||
9921 | 9916 | ||
9922 | if (sim_wide != 0) | 9917 | if (sim_wide != 0) |
9923 | { | 9918 | return lo.GetSimulatorMaxPrimCount(); |
9924 | decimal v = land.SimwideArea * (decimal)(0.22) * (decimal)bonusfactor; | ||
9925 | |||
9926 | return (int)v; | ||
9927 | } | ||
9928 | |||
9929 | else | 9919 | else |
9930 | { | 9920 | return lo.GetParcelMaxPrimCount(); |
9931 | decimal v = land.Area * (decimal)(0.22) * (decimal)bonusfactor; | ||
9932 | |||
9933 | return (int)v; | ||
9934 | } | ||
9935 | |||
9936 | } | 9921 | } |
9937 | 9922 | ||
9938 | public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) | 9923 | public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) |
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index cdab49e..0da9fc1 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Security; | ||
33 | using System.Text; | 34 | using System.Text; |
34 | using log4net; | 35 | using log4net; |
35 | using Nini.Config; | 36 | using Nini.Config; |
@@ -143,7 +144,7 @@ namespace OpenSim.Server.Handlers.Grid | |||
143 | sb.Append("<gridinfo>\n"); | 144 | sb.Append("<gridinfo>\n"); |
144 | foreach (string k in _info.Keys) | 145 | foreach (string k in _info.Keys) |
145 | { | 146 | { |
146 | sb.AppendFormat("<{0}>{1}</{0}>\n", k, _info[k]); | 147 | sb.AppendFormat("<{0}>{1}</{0}>\n", k, SecurityElement.Escape(_info[k].ToString())); |
147 | } | 148 | } |
148 | sb.Append("</gridinfo>\n"); | 149 | sb.Append("</gridinfo>\n"); |
149 | 150 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index c3134b3..0e4dfb9 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs | |||
@@ -40,10 +40,12 @@ namespace OpenSim.Tests.Common.Mock | |||
40 | public class TestLandChannel : ILandChannel | 40 | public class TestLandChannel : ILandChannel |
41 | { | 41 | { |
42 | private Scene m_scene; | 42 | private Scene m_scene; |
43 | private List<ILandObject> m_parcels; | ||
43 | 44 | ||
44 | public TestLandChannel(Scene scene) | 45 | public TestLandChannel(Scene scene) |
45 | { | 46 | { |
46 | m_scene = scene; | 47 | m_scene = scene; |
48 | m_parcels = new List<ILandObject>(); | ||
47 | } | 49 | } |
48 | 50 | ||
49 | public List<ILandObject> ParcelsNearPoint(Vector3 position) | 51 | public List<ILandObject> ParcelsNearPoint(Vector3 position) |
@@ -53,12 +55,19 @@ namespace OpenSim.Tests.Common.Mock | |||
53 | 55 | ||
54 | public List<ILandObject> AllParcels() | 56 | public List<ILandObject> AllParcels() |
55 | { | 57 | { |
56 | return new List<ILandObject>(); | 58 | return m_parcels; |
57 | } | 59 | } |
58 | 60 | ||
59 | public void Clear(bool setupDefaultParcel) | 61 | public void Clear(bool setupDefaultParcel) |
60 | { | 62 | { |
61 | // Intentionally blank since we don't save any parcel data in the test channel | 63 | m_parcels.Clear(); |
64 | |||
65 | if (setupDefaultParcel) | ||
66 | { | ||
67 | ILandObject obj = new LandObject(UUID.Zero, false, m_scene); | ||
68 | obj.LandData.Name = "Your Parcel"; | ||
69 | m_parcels.Add(obj); | ||
70 | } | ||
62 | } | 71 | } |
63 | 72 | ||
64 | protected ILandObject GetNoLand() | 73 | protected ILandObject GetNoLand() |