diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
6 files changed, 1153 insertions, 1056 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 57b7672..e51f118 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -243,7 +243,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
243 | // to the same scene (when this is possible). | 243 | // to the same scene (when this is possible). |
244 | sceneObject.ResetIDs(); | 244 | sceneObject.ResetIDs(); |
245 | 245 | ||
246 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 246 | List<SceneObjectPart> partList = null; |
247 | lock (sceneObject.Children) | ||
248 | partList = new List<SceneObjectPart>(sceneObject.Children.Values); | ||
249 | |||
250 | foreach (SceneObjectPart part in partList) | ||
247 | { | 251 | { |
248 | if (!ResolveUserUuid(part.CreatorID)) | 252 | if (!ResolveUserUuid(part.CreatorID)) |
249 | part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 253 | part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
@@ -261,11 +265,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
261 | // Fix ownership/creator of inventory items | 265 | // Fix ownership/creator of inventory items |
262 | // Not doing so results in inventory items | 266 | // Not doing so results in inventory items |
263 | // being no copy/no mod for everyone | 267 | // being no copy/no mod for everyone |
264 | part.TaskInventory.LockItemsForRead(true); | 268 | lock (part.TaskInventory) |
265 | TaskInventoryDictionary inv = part.TaskInventory; | ||
266 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | ||
267 | { | 269 | { |
268 | if (!ResolveUserUuid(kvp.Value.OwnerID)) | 270 | if (!ResolveUserUuid(part.CreatorID)) |
271 | part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
272 | |||
273 | if (!ResolveUserUuid(part.OwnerID)) | ||
274 | part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
275 | |||
276 | if (!ResolveUserUuid(part.LastOwnerID)) | ||
277 | part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
278 | |||
279 | // And zap any troublesome sit target information | ||
280 | part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
281 | part.SitTargetPosition = new Vector3(0, 0, 0); | ||
282 | |||
283 | // Fix ownership/creator of inventory items | ||
284 | // Not doing so results in inventory items | ||
285 | // being no copy/no mod for everyone | ||
286 | part.TaskInventory.LockItemsForRead(true); | ||
287 | TaskInventoryDictionary inv = part.TaskInventory; | ||
288 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | ||
269 | { | 289 | { |
270 | if (!ResolveUserUuid(kvp.Value.OwnerID)) | 290 | if (!ResolveUserUuid(kvp.Value.OwnerID)) |
271 | { | 291 | { |
@@ -276,8 +296,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
276 | kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 296 | kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
277 | } | 297 | } |
278 | } | 298 | } |
299 | part.TaskInventory.LockItemsForRead(false); | ||
279 | } | 300 | } |
280 | part.TaskInventory.LockItemsForRead(false); | ||
281 | } | 301 | } |
282 | 302 | ||
283 | if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) | 303 | if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 8411d04..fb15d91 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -684,6 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
684 | args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; | 684 | args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; |
685 | args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; | 685 | args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; |
686 | args.simName = m_scene.RegionInfo.RegionName; | 686 | args.simName = m_scene.RegionInfo.RegionName; |
687 | args.regionType = m_scene.RegionInfo.RegionType; | ||
687 | 688 | ||
688 | remote_client.SendRegionInfoToEstateMenu(args); | 689 | remote_client.SendRegionInfoToEstateMenu(args); |
689 | } | 690 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d00cb07..776fe30 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -33,6 +33,8 @@ using System.Reflection; | |||
33 | using log4net; | 33 | using log4net; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | ||
37 | using OpenMetaverse.Messages.Linden; | ||
36 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Capabilities; | 39 | using OpenSim.Framework.Capabilities; |
38 | using OpenSim.Framework.Servers; | 40 | using OpenSim.Framework.Servers; |
@@ -1078,7 +1080,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1078 | { | 1080 | { |
1079 | for (int y = 0; y < inc_y; y++) | 1081 | for (int y = 0; y < inc_y; y++) |
1080 | { | 1082 | { |
1081 | |||
1082 | ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); | 1083 | ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); |
1083 | 1084 | ||
1084 | if (currentParcel != null) | 1085 | if (currentParcel != null) |
@@ -1378,8 +1379,68 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1378 | { | 1379 | { |
1379 | return RemoteParcelRequest(request, path, param, agentID, caps); | 1380 | return RemoteParcelRequest(request, path, param, agentID, caps); |
1380 | })); | 1381 | })); |
1381 | } | 1382 | UUID parcelCapID = UUID.Random(); |
1383 | caps.RegisterHandler("ParcelPropertiesUpdate", | ||
1384 | new RestStreamHandler("POST", "/CAPS/" + parcelCapID, | ||
1385 | delegate(string request, string path, string param, | ||
1386 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
1387 | { | ||
1388 | return ProcessPropertiesUpdate(request, path, param, agentID, caps); | ||
1389 | })); | ||
1390 | } | ||
1391 | private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) | ||
1392 | { | ||
1393 | IClientAPI client; | ||
1394 | if ( ! m_scene.TryGetClient(agentID, out client) ) { | ||
1395 | m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() ); | ||
1396 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | ||
1397 | } | ||
1398 | |||
1399 | ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); | ||
1400 | OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); | ||
1401 | |||
1402 | properties.Deserialize(args); | ||
1403 | |||
1404 | LandUpdateArgs land_update = new LandUpdateArgs(); | ||
1405 | int parcelID = properties.LocalID; | ||
1406 | land_update.AuthBuyerID = properties.AuthBuyerID; | ||
1407 | land_update.Category = properties.Category; | ||
1408 | land_update.Desc = properties.Desc; | ||
1409 | land_update.GroupID = properties.GroupID; | ||
1410 | land_update.LandingType = (byte) properties.Landing; | ||
1411 | land_update.MediaAutoScale = (byte) Convert.ToInt32(properties.MediaAutoScale); | ||
1412 | land_update.MediaID = properties.MediaID; | ||
1413 | land_update.MediaURL = properties.MediaURL; | ||
1414 | land_update.MusicURL = properties.MusicURL; | ||
1415 | land_update.Name = properties.Name; | ||
1416 | land_update.ParcelFlags = (uint) properties.ParcelFlags; | ||
1417 | land_update.PassHours = (int) properties.PassHours; | ||
1418 | land_update.PassPrice = (int) properties.PassPrice; | ||
1419 | land_update.SalePrice = (int) properties.SalePrice; | ||
1420 | land_update.SnapshotID = properties.SnapshotID; | ||
1421 | land_update.UserLocation = properties.UserLocation; | ||
1422 | land_update.UserLookAt = properties.UserLookAt; | ||
1423 | land_update.MediaDescription = properties.MediaDesc; | ||
1424 | land_update.MediaType = properties.MediaType; | ||
1425 | land_update.MediaWidth = properties.MediaWidth; | ||
1426 | land_update.MediaHeight = properties.MediaHeight; | ||
1427 | land_update.MediaLoop = properties.MediaLoop; | ||
1428 | land_update.ObscureMusic = properties.ObscureMusic; | ||
1429 | land_update.ObscureMedia = properties.ObscureMedia; | ||
1430 | |||
1431 | ILandObject land; | ||
1432 | lock (m_landList) | ||
1433 | { | ||
1434 | m_landList.TryGetValue(parcelID, out land); | ||
1435 | } | ||
1382 | 1436 | ||
1437 | if (land != null) { | ||
1438 | land.UpdateLandProperties(land_update, client); | ||
1439 | } else { | ||
1440 | m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); | ||
1441 | } | ||
1442 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | ||
1443 | } | ||
1383 | // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the | 1444 | // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the |
1384 | // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. | 1445 | // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. |
1385 | // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x | 1446 | // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index fcd993c..1b2cabb 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -1,1045 +1,1052 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | 36 | ||
37 | namespace OpenSim.Region.CoreModules.World.Land | 37 | namespace OpenSim.Region.CoreModules.World.Land |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// Keeps track of a specific piece of land's information | 40 | /// Keeps track of a specific piece of land's information |
41 | /// </summary> | 41 | /// </summary> |
42 | public class LandObject : ILandObject | 42 | public class LandObject : ILandObject |
43 | { | 43 | { |
44 | #region Member Variables | 44 | #region Member Variables |
45 | 45 | ||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | #pragma warning disable 0429 | 47 | #pragma warning disable 0429 |
48 | private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; | 48 | private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; |
49 | #pragma warning restore 0429 | 49 | #pragma warning restore 0429 |
50 | private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; | 50 | private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; |
51 | 51 | ||
52 | private int m_lastSeqId = 0; | 52 | private int m_lastSeqId = 0; |
53 | 53 | ||
54 | protected LandData m_landData = new LandData(); | 54 | protected LandData m_landData = new LandData(); |
55 | protected Scene m_scene; | 55 | protected Scene m_scene; |
56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
57 | 57 | ||
58 | public bool[,] LandBitmap | 58 | public bool[,] LandBitmap |
59 | { | 59 | { |
60 | get { return m_landBitmap; } | 60 | get { return m_landBitmap; } |
61 | set { m_landBitmap = value; } | 61 | set { m_landBitmap = value; } |
62 | } | 62 | } |
63 | 63 | ||
64 | #endregion | 64 | #endregion |
65 | 65 | ||
66 | #region ILandObject Members | 66 | #region ILandObject Members |
67 | 67 | ||
68 | public LandData LandData | 68 | public LandData LandData |
69 | { | 69 | { |
70 | get { return m_landData; } | 70 | get { return m_landData; } |
71 | 71 | ||
72 | set { m_landData = value; } | 72 | set { m_landData = value; } |
73 | } | 73 | } |
74 | 74 | ||
75 | public UUID RegionUUID | 75 | public UUID RegionUUID |
76 | { | 76 | { |
77 | get { return m_scene.RegionInfo.RegionID; } | 77 | get { return m_scene.RegionInfo.RegionID; } |
78 | } | 78 | } |
79 | 79 | ||
80 | #region Constructors | 80 | #region Constructors |
81 | 81 | ||
82 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) | 82 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) |
83 | { | 83 | { |
84 | m_scene = scene; | 84 | m_scene = scene; |
85 | LandData.OwnerID = owner_id; | 85 | LandData.OwnerID = owner_id; |
86 | if (is_group_owned) | 86 | if (is_group_owned) |
87 | LandData.GroupID = owner_id; | 87 | LandData.GroupID = owner_id; |
88 | else | 88 | else |
89 | LandData.GroupID = UUID.Zero; | 89 | LandData.GroupID = UUID.Zero; |
90 | LandData.IsGroupOwned = is_group_owned; | 90 | LandData.IsGroupOwned = is_group_owned; |
91 | } | 91 | } |
92 | 92 | ||
93 | #endregion | 93 | #endregion |
94 | 94 | ||
95 | #region Member Functions | 95 | #region Member Functions |
96 | 96 | ||
97 | #region General Functions | 97 | #region General Functions |
98 | 98 | ||
99 | /// <summary> | 99 | /// <summary> |
100 | /// Checks to see if this land object contains a point | 100 | /// Checks to see if this land object contains a point |
101 | /// </summary> | 101 | /// </summary> |
102 | /// <param name="x"></param> | 102 | /// <param name="x"></param> |
103 | /// <param name="y"></param> | 103 | /// <param name="y"></param> |
104 | /// <returns>Returns true if the piece of land contains the specified point</returns> | 104 | /// <returns>Returns true if the piece of land contains the specified point</returns> |
105 | public bool ContainsPoint(int x, int y) | 105 | public bool ContainsPoint(int x, int y) |
106 | { | 106 | { |
107 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) | 107 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) |
108 | { | 108 | { |
109 | return (LandBitmap[x / 4, y / 4] == true); | 109 | return (LandBitmap[x / 4, y / 4] == true); |
110 | } | 110 | } |
111 | else | 111 | else |
112 | { | 112 | { |
113 | return false; | 113 | return false; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | public ILandObject Copy() | 117 | public ILandObject Copy() |
118 | { | 118 | { |
119 | ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene); | 119 | ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene); |
120 | 120 | ||
121 | //Place all new variables here! | 121 | //Place all new variables here! |
122 | newLand.LandBitmap = (bool[,]) (LandBitmap.Clone()); | 122 | newLand.LandBitmap = (bool[,]) (LandBitmap.Clone()); |
123 | newLand.LandData = LandData.Copy(); | 123 | newLand.LandData = LandData.Copy(); |
124 | 124 | ||
125 | return newLand; | 125 | return newLand; |
126 | } | 126 | } |
127 | 127 | ||
128 | static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; | 128 | static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; |
129 | static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; | 129 | static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; |
130 | 130 | ||
131 | public void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) | 131 | public void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) |
132 | { | 132 | { |
133 | overrideParcelMaxPrimCount = overrideDel; | 133 | overrideParcelMaxPrimCount = overrideDel; |
134 | } | 134 | } |
135 | public void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) | 135 | public void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) |
136 | { | 136 | { |
137 | overrideSimulatorMaxPrimCount = overrideDel; | 137 | overrideSimulatorMaxPrimCount = overrideDel; |
138 | } | 138 | } |
139 | 139 | ||
140 | public int GetParcelMaxPrimCount(ILandObject thisObject) | 140 | public int GetParcelMaxPrimCount(ILandObject thisObject) |
141 | { | 141 | { |
142 | if (overrideParcelMaxPrimCount != null) | 142 | if (overrideParcelMaxPrimCount != null) |
143 | { | 143 | { |
144 | return overrideParcelMaxPrimCount(thisObject); | 144 | return overrideParcelMaxPrimCount(thisObject); |
145 | } | 145 | } |
146 | else | 146 | else |
147 | { | 147 | { |
148 | // Normal Calculations | 148 | // Normal Calculations |
149 | return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 149 | return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | public int GetSimulatorMaxPrimCount(ILandObject thisObject) | 152 | public int GetSimulatorMaxPrimCount(ILandObject thisObject) |
153 | { | 153 | { |
154 | if (overrideSimulatorMaxPrimCount != null) | 154 | if (overrideSimulatorMaxPrimCount != null) |
155 | { | 155 | { |
156 | return overrideSimulatorMaxPrimCount(thisObject); | 156 | return overrideSimulatorMaxPrimCount(thisObject); |
157 | } | 157 | } |
158 | else | 158 | else |
159 | { | 159 | { |
160 | //Normal Calculations | 160 | //Normal Calculations |
161 | return m_scene.RegionInfo.ObjectCapacity; | 161 | return m_scene.RegionInfo.ObjectCapacity; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | #endregion | 164 | #endregion |
165 | 165 | ||
166 | #region Packet Request Handling | 166 | #region Packet Request Handling |
167 | 167 | ||
168 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) | 168 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) |
169 | { | 169 | { |
170 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); | 170 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); |
171 | uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); | 171 | uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); |
172 | if (estateModule != null) | 172 | if (estateModule != null) |
173 | regionFlags = estateModule.GetRegionFlags(); | 173 | regionFlags = estateModule.GetRegionFlags(); |
174 | 174 | ||
175 | // In a perfect world, this would have worked. | 175 | // In a perfect world, this would have worked. |
176 | // | 176 | // |
177 | // if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0) | 177 | // if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0) |
178 | // regionFlags |= (uint)RegionFlags.AllowLandmark; | 178 | // regionFlags |= (uint)RegionFlags.AllowLandmark; |
179 | // if (landData.OwnerID == remote_client.AgentId) | 179 | // if (landData.OwnerID == remote_client.AgentId) |
180 | // regionFlags |= (uint)RegionFlags.AllowSetHome; | 180 | // regionFlags |= (uint)RegionFlags.AllowSetHome; |
181 | 181 | ||
182 | int seq_id; | 182 | int seq_id; |
183 | if (snap_selection && (sequence_id == 0)) | 183 | if (snap_selection && (sequence_id == 0)) |
184 | { | 184 | { |
185 | seq_id = m_lastSeqId; | 185 | seq_id = m_lastSeqId; |
186 | } | 186 | } |
187 | else | 187 | else |
188 | { | 188 | { |
189 | seq_id = sequence_id; | 189 | seq_id = sequence_id; |
190 | m_lastSeqId = seq_id; | 190 | m_lastSeqId = seq_id; |
191 | } | 191 | } |
192 | 192 | ||
193 | remote_client.SendLandProperties(seq_id, | 193 | remote_client.SendLandProperties(seq_id, |
194 | snap_selection, request_result, LandData, | 194 | snap_selection, request_result, LandData, |
195 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 195 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
196 | GetParcelMaxPrimCount(this), | 196 | GetParcelMaxPrimCount(this), |
197 | GetSimulatorMaxPrimCount(this), regionFlags); | 197 | GetSimulatorMaxPrimCount(this), regionFlags); |
198 | } | 198 | } |
199 | 199 | ||
200 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) | 200 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) |
201 | { | 201 | { |
202 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) | 202 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) |
203 | { | 203 | { |
204 | //Needs later group support | 204 | //Needs later group support |
205 | bool snap_selection = false; | 205 | bool snap_selection = false; |
206 | LandData newData = LandData.Copy(); | 206 | LandData newData = LandData.Copy(); |
207 | 207 | ||
208 | if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) | 208 | if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) |
209 | { | 209 | { |
210 | if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) | 210 | if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) |
211 | { | 211 | { |
212 | newData.AuthBuyerID = args.AuthBuyerID; | 212 | newData.AuthBuyerID = args.AuthBuyerID; |
213 | newData.SalePrice = args.SalePrice; | 213 | newData.SalePrice = args.SalePrice; |
214 | snap_selection = true; | 214 | snap_selection = true; |
215 | } | 215 | } |
216 | } | 216 | } |
217 | newData.Category = args.Category; | 217 | newData.Category = args.Category; |
218 | newData.Description = args.Desc; | 218 | newData.Description = args.Desc; |
219 | newData.GroupID = args.GroupID; | 219 | newData.GroupID = args.GroupID; |
220 | newData.LandingType = args.LandingType; | 220 | newData.LandingType = args.LandingType; |
221 | newData.MediaAutoScale = args.MediaAutoScale; | 221 | newData.MediaAutoScale = args.MediaAutoScale; |
222 | newData.MediaID = args.MediaID; | 222 | newData.MediaID = args.MediaID; |
223 | newData.MediaURL = args.MediaURL; | 223 | newData.MediaURL = args.MediaURL; |
224 | newData.MusicURL = args.MusicURL; | 224 | newData.MusicURL = args.MusicURL; |
225 | newData.Name = args.Name; | 225 | newData.Name = args.Name; |
226 | newData.Flags = args.ParcelFlags; | 226 | newData.Flags = args.ParcelFlags; |
227 | newData.PassHours = args.PassHours; | 227 | newData.PassHours = args.PassHours; |
228 | newData.PassPrice = args.PassPrice; | 228 | newData.PassPrice = args.PassPrice; |
229 | newData.SnapshotID = args.SnapshotID; | 229 | newData.SnapshotID = args.SnapshotID; |
230 | newData.UserLocation = args.UserLocation; | 230 | newData.UserLocation = args.UserLocation; |
231 | newData.UserLookAt = args.UserLookAt; | 231 | newData.UserLookAt = args.UserLookAt; |
232 | 232 | newData.MediaType = args.MediaType; | |
233 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 233 | newData.MediaDescription = args.MediaDescription; |
234 | 234 | newData.MediaWidth = args.MediaWidth; | |
235 | SendLandUpdateToAvatarsOverMe(snap_selection); | 235 | newData.MediaHeight = args.MediaHeight; |
236 | } | 236 | newData.MediaLoop = args.MediaLoop; |
237 | } | 237 | newData.ObscureMusic = args.ObscureMusic; |
238 | 238 | newData.ObscureMedia = args.ObscureMedia; | |
239 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) | 239 | |
240 | { | 240 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
241 | LandData newData = LandData.Copy(); | 241 | |
242 | newData.OwnerID = avatarID; | 242 | SendLandUpdateToAvatarsOverMe(snap_selection); |
243 | newData.GroupID = groupID; | 243 | } |
244 | newData.IsGroupOwned = groupOwned; | 244 | } |
245 | //newData.auctionID = AuctionID; | 245 | |
246 | newData.ClaimDate = Util.UnixTimeSinceEpoch(); | 246 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) |
247 | newData.ClaimPrice = claimprice; | 247 | { |
248 | newData.SalePrice = 0; | 248 | LandData newData = LandData.Copy(); |
249 | newData.AuthBuyerID = UUID.Zero; | 249 | newData.OwnerID = avatarID; |
250 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 250 | newData.GroupID = groupID; |
251 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 251 | newData.IsGroupOwned = groupOwned; |
252 | 252 | //newData.auctionID = AuctionID; | |
253 | SendLandUpdateToAvatarsOverMe(true); | 253 | newData.ClaimDate = Util.UnixTimeSinceEpoch(); |
254 | } | 254 | newData.ClaimPrice = claimprice; |
255 | 255 | newData.SalePrice = 0; | |
256 | public void DeedToGroup(UUID groupID) | 256 | newData.AuthBuyerID = UUID.Zero; |
257 | { | 257 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
258 | LandData newData = LandData.Copy(); | 258 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
259 | newData.OwnerID = groupID; | 259 | |
260 | newData.GroupID = groupID; | 260 | SendLandUpdateToAvatarsOverMe(true); |
261 | newData.IsGroupOwned = true; | 261 | } |
262 | 262 | ||
263 | // Reset show in directory flag on deed | 263 | public void DeedToGroup(UUID groupID) |
264 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 264 | { |
265 | 265 | LandData newData = LandData.Copy(); | |
266 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 266 | newData.OwnerID = groupID; |
267 | 267 | newData.GroupID = groupID; | |
268 | SendLandUpdateToAvatarsOverMe(true); | 268 | newData.IsGroupOwned = true; |
269 | } | 269 | |
270 | 270 | // Reset show in directory flag on deed | |
271 | public bool IsEitherBannedOrRestricted(UUID avatar) | 271 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
272 | { | 272 | |
273 | if (IsBannedFromLand(avatar)) | 273 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
274 | { | 274 | |
275 | return true; | 275 | SendLandUpdateToAvatarsOverMe(true); |
276 | } | 276 | } |
277 | else if (IsRestrictedFromLand(avatar)) | 277 | |
278 | { | 278 | public bool IsEitherBannedOrRestricted(UUID avatar) |
279 | return true; | 279 | { |
280 | } | 280 | if (IsBannedFromLand(avatar)) |
281 | return false; | 281 | { |
282 | } | 282 | return true; |
283 | 283 | } | |
284 | public bool HasGroupAccess(UUID avatar) | 284 | else if (IsRestrictedFromLand(avatar)) |
285 | { | 285 | { |
286 | if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | 286 | return true; |
287 | { | 287 | } |
288 | IGroupsModule groupsModule = | 288 | return false; |
289 | m_scene.RequestModuleInterface<IGroupsModule>(); | 289 | } |
290 | 290 | ||
291 | List<UUID> agentGroups = new List<UUID>(); | 291 | public bool HasGroupAccess(UUID avatar) |
292 | if (groupsModule != null) | 292 | { |
293 | { | 293 | if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) |
294 | GroupMembershipData[] GroupMembership = | 294 | { |
295 | groupsModule.GetMembershipData(avatar); | 295 | IGroupsModule groupsModule = |
296 | 296 | m_scene.RequestModuleInterface<IGroupsModule>(); | |
297 | if (GroupMembership != null) | 297 | |
298 | { | 298 | List<UUID> agentGroups = new List<UUID>(); |
299 | for (int i = 0; i < GroupMembership.Length; i++) | 299 | if (groupsModule != null) |
300 | { | 300 | { |
301 | if (LandData.GroupID == GroupMembership[i].GroupID) | 301 | GroupMembershipData[] GroupMembership = |
302 | { | 302 | groupsModule.GetMembershipData(avatar); |
303 | return true; | 303 | |
304 | } | 304 | if (GroupMembership != null) |
305 | } | 305 | { |
306 | } | 306 | for (int i = 0; i < GroupMembership.Length; i++) |
307 | } | 307 | { |
308 | } | 308 | if (LandData.GroupID == GroupMembership[i].GroupID) |
309 | return false; | 309 | { |
310 | } | 310 | return true; |
311 | 311 | } | |
312 | public bool IsBannedFromLand(UUID avatar) | 312 | } |
313 | { | 313 | } |
314 | if (m_scene.Permissions.IsAdministrator(avatar)) | 314 | } |
315 | return false; | 315 | } |
316 | 316 | return false; | |
317 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 317 | } |
318 | { | 318 | |
319 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 319 | public bool IsBannedFromLand(UUID avatar) |
320 | entry.AgentID = avatar; | 320 | { |
321 | entry.Flags = AccessList.Ban; | 321 | if (m_scene.Permissions.IsAdministrator(avatar)) |
322 | entry.Time = new DateTime(); | 322 | return false; |
323 | //See if they are on the list, but make sure the owner isn't banned | 323 | |
324 | if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) | 324 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
325 | { | 325 | { |
326 | //They are banned, so lets send them a notice about this parcel | 326 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
327 | return true; | 327 | entry.AgentID = avatar; |
328 | } | 328 | entry.Flags = AccessList.Ban; |
329 | } | 329 | entry.Time = new DateTime(); |
330 | return false; | 330 | //See if they are on the list, but make sure the owner isn't banned |
331 | } | 331 | if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) |
332 | 332 | { | |
333 | public bool IsRestrictedFromLand(UUID avatar) | 333 | //They are banned, so lets send them a notice about this parcel |
334 | { | 334 | return true; |
335 | if (m_scene.Permissions.IsAdministrator(avatar)) | 335 | } |
336 | return false; | 336 | } |
337 | 337 | return false; | |
338 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 338 | } |
339 | { | 339 | |
340 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 340 | public bool IsRestrictedFromLand(UUID avatar) |
341 | entry.AgentID = avatar; | 341 | { |
342 | entry.Flags = AccessList.Access; | 342 | if (m_scene.Permissions.IsAdministrator(avatar)) |
343 | entry.Time = new DateTime(); | 343 | return false; |
344 | 344 | ||
345 | //If they are not on the access list and are not the owner | 345 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
346 | if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) | 346 | { |
347 | { | 347 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
348 | if (!HasGroupAccess(avatar)) | 348 | entry.AgentID = avatar; |
349 | { | 349 | entry.Flags = AccessList.Access; |
350 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel | 350 | entry.Time = new DateTime(); |
351 | return true; | 351 | |
352 | } | 352 | //If they are not on the access list and are not the owner |
353 | } | 353 | if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) |
354 | } | 354 | { |
355 | 355 | if (!HasGroupAccess(avatar)) | |
356 | return false; | 356 | { |
357 | } | 357 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel |
358 | 358 | return true; | |
359 | public void SendLandUpdateToClient(IClientAPI remote_client) | 359 | } |
360 | { | 360 | } |
361 | SendLandProperties(0, false, 0, remote_client); | 361 | } |
362 | } | 362 | |
363 | 363 | return false; | |
364 | public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) | 364 | } |
365 | { | 365 | |
366 | SendLandProperties(0, snap_selection, 0, remote_client); | 366 | public void SendLandUpdateToClient(IClientAPI remote_client) |
367 | } | 367 | { |
368 | 368 | SendLandProperties(0, false, 0, remote_client); | |
369 | public void SendLandUpdateToAvatarsOverMe() | 369 | } |
370 | { | 370 | |
371 | SendLandUpdateToAvatarsOverMe(false); | 371 | public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) |
372 | } | 372 | { |
373 | 373 | SendLandProperties(0, snap_selection, 0, remote_client); | |
374 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) | 374 | } |
375 | { | 375 | |
376 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) | 376 | public void SendLandUpdateToAvatarsOverMe() |
377 | { | 377 | { |
378 | if (avatar.IsChildAgent) | 378 | SendLandUpdateToAvatarsOverMe(false); |
379 | return; | 379 | } |
380 | 380 | ||
381 | ILandObject over = null; | 381 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) |
382 | try | 382 | { |
383 | { | 383 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) |
384 | over = | 384 | { |
385 | m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), | 385 | if (avatar.IsChildAgent) |
386 | Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); | 386 | return; |
387 | } | 387 | |
388 | catch (Exception) | 388 | ILandObject over = null; |
389 | { | 389 | try |
390 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + | 390 | { |
391 | Math.Round(avatar.AbsolutePosition.Y)); | 391 | over = |
392 | } | 392 | m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), |
393 | 393 | Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); | |
394 | if (over != null) | 394 | } |
395 | { | 395 | catch (Exception) |
396 | if (over.LandData.LocalID == LandData.LocalID) | 396 | { |
397 | { | 397 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + |
398 | if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && | 398 | Math.Round(avatar.AbsolutePosition.Y)); |
399 | m_scene.RegionInfo.RegionSettings.AllowDamage) | 399 | } |
400 | avatar.Invulnerable = false; | 400 | |
401 | else | 401 | if (over != null) |
402 | avatar.Invulnerable = true; | 402 | { |
403 | 403 | if (over.LandData.LocalID == LandData.LocalID) | |
404 | SendLandUpdateToClient(snap_selection, avatar.ControllingClient); | 404 | { |
405 | } | 405 | if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && |
406 | } | 406 | m_scene.RegionInfo.RegionSettings.AllowDamage) |
407 | }); | 407 | avatar.Invulnerable = false; |
408 | } | 408 | else |
409 | 409 | avatar.Invulnerable = true; | |
410 | #endregion | 410 | |
411 | 411 | SendLandUpdateToClient(snap_selection, avatar.ControllingClient); | |
412 | #region AccessList Functions | 412 | } |
413 | 413 | } | |
414 | public List<UUID> CreateAccessListArrayByFlag(AccessList flag) | 414 | }); |
415 | { | 415 | } |
416 | List<UUID> list = new List<UUID>(); | 416 | |
417 | foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList) | 417 | #endregion |
418 | { | 418 | |
419 | if (entry.Flags == flag) | 419 | #region AccessList Functions |
420 | { | 420 | |
421 | list.Add(entry.AgentID); | 421 | public List<UUID> CreateAccessListArrayByFlag(AccessList flag) |
422 | } | 422 | { |
423 | } | 423 | List<UUID> list = new List<UUID>(); |
424 | if (list.Count == 0) | 424 | foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList) |
425 | { | 425 | { |
426 | list.Add(UUID.Zero); | 426 | if (entry.Flags == flag) |
427 | } | 427 | { |
428 | 428 | list.Add(entry.AgentID); | |
429 | return list; | 429 | } |
430 | } | 430 | } |
431 | 431 | if (list.Count == 0) | |
432 | public void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, | 432 | { |
433 | IClientAPI remote_client) | 433 | list.Add(UUID.Zero); |
434 | { | 434 | } |
435 | 435 | ||
436 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) | 436 | return list; |
437 | { | 437 | } |
438 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); | 438 | |
439 | remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); | 439 | public void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, |
440 | } | 440 | IClientAPI remote_client) |
441 | 441 | { | |
442 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) | 442 | |
443 | { | 443 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) |
444 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); | 444 | { |
445 | remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); | 445 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); |
446 | } | 446 | remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); |
447 | } | 447 | } |
448 | 448 | ||
449 | public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) | 449 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) |
450 | { | 450 | { |
451 | LandData newData = LandData.Copy(); | 451 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); |
452 | 452 | remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); | |
453 | if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) | 453 | } |
454 | { | 454 | } |
455 | entries.Clear(); | 455 | |
456 | } | 456 | public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) |
457 | 457 | { | |
458 | List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); | 458 | LandData newData = LandData.Copy(); |
459 | foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) | 459 | |
460 | { | 460 | if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) |
461 | if (entry.Flags == (AccessList)flags) | 461 | { |
462 | { | 462 | entries.Clear(); |
463 | toRemove.Add(entry); | 463 | } |
464 | } | 464 | |
465 | } | 465 | List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); |
466 | 466 | foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) | |
467 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) | 467 | { |
468 | { | 468 | if (entry.Flags == (AccessList)flags) |
469 | newData.ParcelAccessList.Remove(entry); | 469 | { |
470 | } | 470 | toRemove.Add(entry); |
471 | foreach (ParcelManager.ParcelAccessEntry entry in entries) | 471 | } |
472 | { | 472 | } |
473 | ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); | 473 | |
474 | temp.AgentID = entry.AgentID; | 474 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) |
475 | temp.Time = new DateTime(); //Pointless? Yes. | 475 | { |
476 | temp.Flags = (AccessList)flags; | 476 | newData.ParcelAccessList.Remove(entry); |
477 | 477 | } | |
478 | if (!newData.ParcelAccessList.Contains(temp)) | 478 | foreach (ParcelManager.ParcelAccessEntry entry in entries) |
479 | { | 479 | { |
480 | newData.ParcelAccessList.Add(temp); | 480 | ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); |
481 | } | 481 | temp.AgentID = entry.AgentID; |
482 | } | 482 | temp.Time = new DateTime(); //Pointless? Yes. |
483 | 483 | temp.Flags = (AccessList)flags; | |
484 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 484 | |
485 | } | 485 | if (!newData.ParcelAccessList.Contains(temp)) |
486 | 486 | { | |
487 | #endregion | 487 | newData.ParcelAccessList.Add(temp); |
488 | 488 | } | |
489 | #region Update Functions | 489 | } |
490 | 490 | ||
491 | public void UpdateLandBitmapByteArray() | 491 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
492 | { | 492 | } |
493 | LandData.Bitmap = ConvertLandBitmapToBytes(); | 493 | |
494 | } | 494 | #endregion |
495 | 495 | ||
496 | /// <summary> | 496 | #region Update Functions |
497 | /// Update all settings in land such as area, bitmap byte array, etc | 497 | |
498 | /// </summary> | 498 | public void UpdateLandBitmapByteArray() |
499 | public void ForceUpdateLandInfo() | 499 | { |
500 | { | 500 | LandData.Bitmap = ConvertLandBitmapToBytes(); |
501 | UpdateAABBAndAreaValues(); | 501 | } |
502 | UpdateLandBitmapByteArray(); | 502 | |
503 | } | 503 | /// <summary> |
504 | 504 | /// Update all settings in land such as area, bitmap byte array, etc | |
505 | public void SetLandBitmapFromByteArray() | 505 | /// </summary> |
506 | { | 506 | public void ForceUpdateLandInfo() |
507 | LandBitmap = ConvertBytesToLandBitmap(); | 507 | { |
508 | } | 508 | UpdateAABBAndAreaValues(); |
509 | 509 | UpdateLandBitmapByteArray(); | |
510 | /// <summary> | 510 | } |
511 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object | 511 | |
512 | /// </summary> | 512 | public void SetLandBitmapFromByteArray() |
513 | private void UpdateAABBAndAreaValues() | 513 | { |
514 | { | 514 | LandBitmap = ConvertBytesToLandBitmap(); |
515 | int min_x = 64; | 515 | } |
516 | int min_y = 64; | 516 | |
517 | int max_x = 0; | 517 | /// <summary> |
518 | int max_y = 0; | 518 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object |
519 | int tempArea = 0; | 519 | /// </summary> |
520 | int x, y; | 520 | private void UpdateAABBAndAreaValues() |
521 | for (x = 0; x < 64; x++) | 521 | { |
522 | { | 522 | int min_x = 64; |
523 | for (y = 0; y < 64; y++) | 523 | int min_y = 64; |
524 | { | 524 | int max_x = 0; |
525 | if (LandBitmap[x, y] == true) | 525 | int max_y = 0; |
526 | { | 526 | int tempArea = 0; |
527 | if (min_x > x) min_x = x; | 527 | int x, y; |
528 | if (min_y > y) min_y = y; | 528 | for (x = 0; x < 64; x++) |
529 | if (max_x < x) max_x = x; | 529 | { |
530 | if (max_y < y) max_y = y; | 530 | for (y = 0; y < 64; y++) |
531 | tempArea += 16; //16sqm peice of land | 531 | { |
532 | } | 532 | if (LandBitmap[x, y] == true) |
533 | } | 533 | { |
534 | } | 534 | if (min_x > x) min_x = x; |
535 | int tx = min_x * 4; | 535 | if (min_y > y) min_y = y; |
536 | if (tx > ((int)Constants.RegionSize - 1)) | 536 | if (max_x < x) max_x = x; |
537 | tx = ((int)Constants.RegionSize - 1); | 537 | if (max_y < y) max_y = y; |
538 | int ty = min_y * 4; | 538 | tempArea += 16; //16sqm peice of land |
539 | if (ty > ((int)Constants.RegionSize - 1)) | 539 | } |
540 | ty = ((int)Constants.RegionSize - 1); | 540 | } |
541 | LandData.AABBMin = | 541 | } |
542 | new Vector3((float) (min_x * 4), (float) (min_y * 4), | 542 | int tx = min_x * 4; |
543 | (float) m_scene.Heightmap[tx, ty]); | 543 | if (tx > ((int)Constants.RegionSize - 1)) |
544 | 544 | tx = ((int)Constants.RegionSize - 1); | |
545 | tx = max_x * 4; | 545 | int ty = min_y * 4; |
546 | if (tx > ((int)Constants.RegionSize - 1)) | 546 | if (ty > ((int)Constants.RegionSize - 1)) |
547 | tx = ((int)Constants.RegionSize - 1); | 547 | ty = ((int)Constants.RegionSize - 1); |
548 | ty = max_y * 4; | 548 | LandData.AABBMin = |
549 | if (ty > ((int)Constants.RegionSize - 1)) | 549 | new Vector3((float) (min_x * 4), (float) (min_y * 4), |
550 | ty = ((int)Constants.RegionSize - 1); | 550 | (float) m_scene.Heightmap[tx, ty]); |
551 | LandData.AABBMax = | 551 | |
552 | new Vector3((float) (max_x * 4), (float) (max_y * 4), | 552 | tx = max_x * 4; |
553 | (float) m_scene.Heightmap[tx, ty]); | 553 | if (tx > ((int)Constants.RegionSize - 1)) |
554 | LandData.Area = tempArea; | 554 | tx = ((int)Constants.RegionSize - 1); |
555 | } | 555 | ty = max_y * 4; |
556 | 556 | if (ty > ((int)Constants.RegionSize - 1)) | |
557 | #endregion | 557 | ty = ((int)Constants.RegionSize - 1); |
558 | 558 | LandData.AABBMax = | |
559 | #region Land Bitmap Functions | 559 | new Vector3((float) (max_x * 4), (float) (max_y * 4), |
560 | 560 | (float) m_scene.Heightmap[tx, ty]); | |
561 | /// <summary> | 561 | LandData.Area = tempArea; |
562 | /// Sets the land's bitmap manually | 562 | } |
563 | /// </summary> | 563 | |
564 | /// <param name="bitmap">64x64 block representing where this land is on a map</param> | 564 | #endregion |
565 | public void SetLandBitmap(bool[,] bitmap) | 565 | |
566 | { | 566 | #region Land Bitmap Functions |
567 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) | 567 | |
568 | { | 568 | /// <summary> |
569 | //Throw an exception - The bitmap is not 64x64 | 569 | /// Sets the land's bitmap manually |
570 | //throw new Exception("Error: Invalid Parcel Bitmap"); | 570 | /// </summary> |
571 | } | 571 | /// <param name="bitmap">64x64 block representing where this land is on a map</param> |
572 | else | 572 | public void SetLandBitmap(bool[,] bitmap) |
573 | { | 573 | { |
574 | //Valid: Lets set it | 574 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) |
575 | LandBitmap = bitmap; | 575 | { |
576 | ForceUpdateLandInfo(); | 576 | //Throw an exception - The bitmap is not 64x64 |
577 | } | 577 | //throw new Exception("Error: Invalid Parcel Bitmap"); |
578 | } | 578 | } |
579 | 579 | else | |
580 | /// <summary> | 580 | { |
581 | /// Gets the land's bitmap manually | 581 | //Valid: Lets set it |
582 | /// </summary> | 582 | LandBitmap = bitmap; |
583 | /// <returns></returns> | 583 | ForceUpdateLandInfo(); |
584 | public bool[,] GetLandBitmap() | 584 | } |
585 | { | 585 | } |
586 | return LandBitmap; | 586 | |
587 | } | 587 | /// <summary> |
588 | 588 | /// Gets the land's bitmap manually | |
589 | /// <summary> | 589 | /// </summary> |
590 | /// Full sim land object creation | 590 | /// <returns></returns> |
591 | /// </summary> | 591 | public bool[,] GetLandBitmap() |
592 | /// <returns></returns> | 592 | { |
593 | public bool[,] BasicFullRegionLandBitmap() | 593 | return LandBitmap; |
594 | { | 594 | } |
595 | return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); | 595 | |
596 | } | 596 | /// <summary> |
597 | 597 | /// Full sim land object creation | |
598 | /// <summary> | 598 | /// </summary> |
599 | /// Used to modify the bitmap between the x and y points. Points use 64 scale | 599 | /// <returns></returns> |
600 | /// </summary> | 600 | public bool[,] BasicFullRegionLandBitmap() |
601 | /// <param name="start_x"></param> | 601 | { |
602 | /// <param name="start_y"></param> | 602 | return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); |
603 | /// <param name="end_x"></param> | 603 | } |
604 | /// <param name="end_y"></param> | 604 | |
605 | /// <returns></returns> | 605 | /// <summary> |
606 | public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) | 606 | /// Used to modify the bitmap between the x and y points. Points use 64 scale |
607 | { | 607 | /// </summary> |
608 | bool[,] tempBitmap = new bool[64,64]; | 608 | /// <param name="start_x"></param> |
609 | tempBitmap.Initialize(); | 609 | /// <param name="start_y"></param> |
610 | 610 | /// <param name="end_x"></param> | |
611 | tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); | 611 | /// <param name="end_y"></param> |
612 | return tempBitmap; | 612 | /// <returns></returns> |
613 | } | 613 | public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) |
614 | 614 | { | |
615 | /// <summary> | 615 | bool[,] tempBitmap = new bool[64,64]; |
616 | /// Change a land bitmap at within a square and set those points to a specific value | 616 | tempBitmap.Initialize(); |
617 | /// </summary> | 617 | |
618 | /// <param name="land_bitmap"></param> | 618 | tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); |
619 | /// <param name="start_x"></param> | 619 | return tempBitmap; |
620 | /// <param name="start_y"></param> | 620 | } |
621 | /// <param name="end_x"></param> | 621 | |
622 | /// <param name="end_y"></param> | 622 | /// <summary> |
623 | /// <param name="set_value"></param> | 623 | /// Change a land bitmap at within a square and set those points to a specific value |
624 | /// <returns></returns> | 624 | /// </summary> |
625 | public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, | 625 | /// <param name="land_bitmap"></param> |
626 | bool set_value) | 626 | /// <param name="start_x"></param> |
627 | { | 627 | /// <param name="start_y"></param> |
628 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) | 628 | /// <param name="end_x"></param> |
629 | { | 629 | /// <param name="end_y"></param> |
630 | //Throw an exception - The bitmap is not 64x64 | 630 | /// <param name="set_value"></param> |
631 | //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); | 631 | /// <returns></returns> |
632 | } | 632 | public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, |
633 | 633 | bool set_value) | |
634 | int x, y; | 634 | { |
635 | for (y = 0; y < 64; y++) | 635 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) |
636 | { | 636 | { |
637 | for (x = 0; x < 64; x++) | 637 | //Throw an exception - The bitmap is not 64x64 |
638 | { | 638 | //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); |
639 | if (x >= start_x / 4 && x < end_x / 4 | 639 | } |
640 | && y >= start_y / 4 && y < end_y / 4) | 640 | |
641 | { | 641 | int x, y; |
642 | land_bitmap[x, y] = set_value; | 642 | for (y = 0; y < 64; y++) |
643 | } | 643 | { |
644 | } | 644 | for (x = 0; x < 64; x++) |
645 | } | 645 | { |
646 | return land_bitmap; | 646 | if (x >= start_x / 4 && x < end_x / 4 |
647 | } | 647 | && y >= start_y / 4 && y < end_y / 4) |
648 | 648 | { | |
649 | /// <summary> | 649 | land_bitmap[x, y] = set_value; |
650 | /// Join the true values of 2 bitmaps together | 650 | } |
651 | /// </summary> | 651 | } |
652 | /// <param name="bitmap_base"></param> | 652 | } |
653 | /// <param name="bitmap_add"></param> | 653 | return land_bitmap; |
654 | /// <returns></returns> | 654 | } |
655 | public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) | 655 | |
656 | { | 656 | /// <summary> |
657 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) | 657 | /// Join the true values of 2 bitmaps together |
658 | { | 658 | /// </summary> |
659 | //Throw an exception - The bitmap is not 64x64 | 659 | /// <param name="bitmap_base"></param> |
660 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); | 660 | /// <param name="bitmap_add"></param> |
661 | } | 661 | /// <returns></returns> |
662 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) | 662 | public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) |
663 | { | 663 | { |
664 | //Throw an exception - The bitmap is not 64x64 | 664 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) |
665 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); | 665 | { |
666 | } | 666 | //Throw an exception - The bitmap is not 64x64 |
667 | 667 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); | |
668 | int x, y; | 668 | } |
669 | for (y = 0; y < 64; y++) | 669 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) |
670 | { | 670 | { |
671 | for (x = 0; x < 64; x++) | 671 | //Throw an exception - The bitmap is not 64x64 |
672 | { | 672 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); |
673 | if (bitmap_add[x, y]) | 673 | } |
674 | { | 674 | |
675 | bitmap_base[x, y] = true; | 675 | int x, y; |
676 | } | 676 | for (y = 0; y < 64; y++) |
677 | } | 677 | { |
678 | } | 678 | for (x = 0; x < 64; x++) |
679 | return bitmap_base; | 679 | { |
680 | } | 680 | if (bitmap_add[x, y]) |
681 | 681 | { | |
682 | /// <summary> | 682 | bitmap_base[x, y] = true; |
683 | /// Converts the land bitmap to a packet friendly byte array | 683 | } |
684 | /// </summary> | 684 | } |
685 | /// <returns></returns> | 685 | } |
686 | private byte[] ConvertLandBitmapToBytes() | 686 | return bitmap_base; |
687 | { | 687 | } |
688 | byte[] tempConvertArr = new byte[512]; | 688 | |
689 | byte tempByte = 0; | 689 | /// <summary> |
690 | int x, y, i, byteNum = 0; | 690 | /// Converts the land bitmap to a packet friendly byte array |
691 | i = 0; | 691 | /// </summary> |
692 | for (y = 0; y < 64; y++) | 692 | /// <returns></returns> |
693 | { | 693 | private byte[] ConvertLandBitmapToBytes() |
694 | for (x = 0; x < 64; x++) | 694 | { |
695 | { | 695 | byte[] tempConvertArr = new byte[512]; |
696 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); | 696 | byte tempByte = 0; |
697 | if (i % 8 == 0) | 697 | int x, y, i, byteNum = 0; |
698 | { | 698 | i = 0; |
699 | tempConvertArr[byteNum] = tempByte; | 699 | for (y = 0; y < 64; y++) |
700 | tempByte = (byte) 0; | 700 | { |
701 | i = 0; | 701 | for (x = 0; x < 64; x++) |
702 | byteNum++; | 702 | { |
703 | } | 703 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); |
704 | } | 704 | if (i % 8 == 0) |
705 | } | 705 | { |
706 | return tempConvertArr; | 706 | tempConvertArr[byteNum] = tempByte; |
707 | } | 707 | tempByte = (byte) 0; |
708 | 708 | i = 0; | |
709 | private bool[,] ConvertBytesToLandBitmap() | 709 | byteNum++; |
710 | { | 710 | } |
711 | bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; | 711 | } |
712 | tempConvertMap.Initialize(); | 712 | } |
713 | byte tempByte = 0; | 713 | return tempConvertArr; |
714 | int x = 0, y = 0, i = 0, bitNum = 0; | 714 | } |
715 | for (i = 0; i < 512; i++) | 715 | |
716 | { | 716 | private bool[,] ConvertBytesToLandBitmap() |
717 | tempByte = LandData.Bitmap[i]; | 717 | { |
718 | for (bitNum = 0; bitNum < 8; bitNum++) | 718 | bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; |
719 | { | 719 | tempConvertMap.Initialize(); |
720 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); | 720 | byte tempByte = 0; |
721 | tempConvertMap[x, y] = bit; | 721 | int x = 0, y = 0, i = 0, bitNum = 0; |
722 | x++; | 722 | for (i = 0; i < 512; i++) |
723 | if (x > 63) | 723 | { |
724 | { | 724 | tempByte = LandData.Bitmap[i]; |
725 | x = 0; | 725 | for (bitNum = 0; bitNum < 8; bitNum++) |
726 | y++; | 726 | { |
727 | } | 727 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); |
728 | } | 728 | tempConvertMap[x, y] = bit; |
729 | } | 729 | x++; |
730 | return tempConvertMap; | 730 | if (x > 63) |
731 | } | 731 | { |
732 | 732 | x = 0; | |
733 | #endregion | 733 | y++; |
734 | 734 | } | |
735 | #region Object Select and Object Owner Listing | 735 | } |
736 | 736 | } | |
737 | public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) | 737 | return tempConvertMap; |
738 | { | 738 | } |
739 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) | 739 | |
740 | { | 740 | #endregion |
741 | List<uint> resultLocalIDs = new List<uint>(); | 741 | |
742 | try | 742 | #region Object Select and Object Owner Listing |
743 | { | 743 | |
744 | lock (primsOverMe) | 744 | public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) |
745 | { | 745 | { |
746 | foreach (SceneObjectGroup obj in primsOverMe) | 746 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) |
747 | { | 747 | { |
748 | if (obj.LocalId > 0) | 748 | List<uint> resultLocalIDs = new List<uint>(); |
749 | { | 749 | try |
750 | if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == LandData.OwnerID) | 750 | { |
751 | { | 751 | lock (primsOverMe) |
752 | resultLocalIDs.Add(obj.LocalId); | 752 | { |
753 | } | 753 | foreach (SceneObjectGroup obj in primsOverMe) |
754 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero) | 754 | { |
755 | { | 755 | if (obj.LocalId > 0) |
756 | resultLocalIDs.Add(obj.LocalId); | 756 | { |
757 | } | 757 | if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == LandData.OwnerID) |
758 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && | 758 | { |
759 | obj.OwnerID != remote_client.AgentId) | 759 | resultLocalIDs.Add(obj.LocalId); |
760 | { | 760 | } |
761 | resultLocalIDs.Add(obj.LocalId); | 761 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero) |
762 | } | 762 | { |
763 | else if (request_type == (int)ObjectReturnType.List && returnIDs.Contains(obj.OwnerID)) | 763 | resultLocalIDs.Add(obj.LocalId); |
764 | { | 764 | } |
765 | resultLocalIDs.Add(obj.LocalId); | 765 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && |
766 | } | 766 | obj.OwnerID != remote_client.AgentId) |
767 | } | 767 | { |
768 | } | 768 | resultLocalIDs.Add(obj.LocalId); |
769 | } | 769 | } |
770 | } catch (InvalidOperationException) | 770 | else if (request_type == (int)ObjectReturnType.List && returnIDs.Contains(obj.OwnerID)) |
771 | { | 771 | { |
772 | m_log.Error("[LAND]: Unable to force select the parcel objects. Arr."); | 772 | resultLocalIDs.Add(obj.LocalId); |
773 | } | 773 | } |
774 | 774 | } | |
775 | remote_client.SendForceClientSelectObjects(resultLocalIDs); | 775 | } |
776 | } | 776 | } |
777 | } | 777 | } catch (InvalidOperationException) |
778 | 778 | { | |
779 | /// <summary> | 779 | m_log.Error("[LAND]: Unable to force select the parcel objects. Arr."); |
780 | /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes | 780 | } |
781 | /// aggreagete details such as the number of prims. | 781 | |
782 | /// | 782 | remote_client.SendForceClientSelectObjects(resultLocalIDs); |
783 | /// </summary> | 783 | } |
784 | /// <param name="remote_client"> | 784 | } |
785 | /// A <see cref="IClientAPI"/> | 785 | |
786 | /// </param> | 786 | /// <summary> |
787 | public void SendLandObjectOwners(IClientAPI remote_client) | 787 | /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes |
788 | { | 788 | /// aggreagete details such as the number of prims. |
789 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) | 789 | /// |
790 | { | 790 | /// </summary> |
791 | Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); | 791 | /// <param name="remote_client"> |
792 | List<UUID> groups = new List<UUID>(); | 792 | /// A <see cref="IClientAPI"/> |
793 | 793 | /// </param> | |
794 | lock (primsOverMe) | 794 | public void SendLandObjectOwners(IClientAPI remote_client) |
795 | { | 795 | { |
796 | try | 796 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) |
797 | { | 797 | { |
798 | 798 | Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); | |
799 | foreach (SceneObjectGroup obj in primsOverMe) | 799 | List<UUID> groups = new List<UUID>(); |
800 | { | 800 | |
801 | try | 801 | lock (primsOverMe) |
802 | { | 802 | { |
803 | if (!primCount.ContainsKey(obj.OwnerID)) | 803 | try |
804 | { | 804 | { |
805 | primCount.Add(obj.OwnerID, 0); | 805 | |
806 | } | 806 | foreach (SceneObjectGroup obj in primsOverMe) |
807 | } | 807 | { |
808 | catch (NullReferenceException) | 808 | try |
809 | { | 809 | { |
810 | m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); | 810 | if (!primCount.ContainsKey(obj.OwnerID)) |
811 | } | 811 | { |
812 | try | 812 | primCount.Add(obj.OwnerID, 0); |
813 | { | 813 | } |
814 | primCount[obj.OwnerID] += obj.PrimCount; | 814 | } |
815 | } | 815 | catch (NullReferenceException) |
816 | catch (KeyNotFoundException) | 816 | { |
817 | { | 817 | m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); |
818 | m_log.Error("[LAND]: Unable to match a prim with it's owner."); | 818 | } |
819 | } | 819 | try |
820 | if (obj.OwnerID == obj.GroupID && (!groups.Contains(obj.OwnerID))) | 820 | { |
821 | groups.Add(obj.OwnerID); | 821 | primCount[obj.OwnerID] += obj.PrimCount; |
822 | } | 822 | } |
823 | } | 823 | catch (KeyNotFoundException) |
824 | catch (InvalidOperationException) | 824 | { |
825 | { | 825 | m_log.Error("[LAND]: Unable to match a prim with it's owner."); |
826 | m_log.Error("[LAND]: Unable to Enumerate Land object arr."); | 826 | } |
827 | } | 827 | if (obj.OwnerID == obj.GroupID && (!groups.Contains(obj.OwnerID))) |
828 | } | 828 | groups.Add(obj.OwnerID); |
829 | 829 | } | |
830 | remote_client.SendLandObjectOwners(LandData, groups, primCount); | 830 | } |
831 | } | 831 | catch (InvalidOperationException) |
832 | } | 832 | { |
833 | 833 | m_log.Error("[LAND]: Unable to Enumerate Land object arr."); | |
834 | public Dictionary<UUID, int> GetLandObjectOwners() | 834 | } |
835 | { | 835 | } |
836 | Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); | 836 | |
837 | lock (primsOverMe) | 837 | remote_client.SendLandObjectOwners(LandData, groups, primCount); |
838 | { | 838 | } |
839 | try | 839 | } |
840 | { | 840 | |
841 | 841 | public Dictionary<UUID, int> GetLandObjectOwners() | |
842 | foreach (SceneObjectGroup obj in primsOverMe) | 842 | { |
843 | { | 843 | Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); |
844 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) | 844 | lock (primsOverMe) |
845 | { | 845 | { |
846 | ownersAndCount.Add(obj.OwnerID, 0); | 846 | try |
847 | } | 847 | { |
848 | ownersAndCount[obj.OwnerID] += obj.PrimCount; | 848 | |
849 | } | 849 | foreach (SceneObjectGroup obj in primsOverMe) |
850 | } | 850 | { |
851 | catch (InvalidOperationException) | 851 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) |
852 | { | 852 | { |
853 | m_log.Error("[LAND]: Unable to enumerate land owners. arr."); | 853 | ownersAndCount.Add(obj.OwnerID, 0); |
854 | } | 854 | } |
855 | 855 | ownersAndCount[obj.OwnerID] += obj.PrimCount; | |
856 | } | 856 | } |
857 | return ownersAndCount; | 857 | } |
858 | } | 858 | catch (InvalidOperationException) |
859 | 859 | { | |
860 | #endregion | 860 | m_log.Error("[LAND]: Unable to enumerate land owners. arr."); |
861 | 861 | } | |
862 | #region Object Returning | 862 | |
863 | 863 | } | |
864 | public void ReturnObject(SceneObjectGroup obj) | 864 | return ownersAndCount; |
865 | { | 865 | } |
866 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | 866 | |
867 | objs[0] = obj; | 867 | #endregion |
868 | m_scene.returnObjects(objs, obj.OwnerID); | 868 | |
869 | } | 869 | #region Object Returning |
870 | 870 | ||
871 | public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) | 871 | public void ReturnObject(SceneObjectGroup obj) |
872 | { | 872 | { |
873 | Dictionary<UUID,List<SceneObjectGroup>> returns = | 873 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; |
874 | new Dictionary<UUID,List<SceneObjectGroup>>(); | 874 | objs[0] = obj; |
875 | 875 | m_scene.returnObjects(objs, obj.OwnerID); | |
876 | lock (primsOverMe) | 876 | } |
877 | { | 877 | |
878 | if (type == (uint)ObjectReturnType.Owner) | 878 | public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) |
879 | { | 879 | { |
880 | foreach (SceneObjectGroup obj in primsOverMe) | 880 | Dictionary<UUID,List<SceneObjectGroup>> returns = |
881 | { | 881 | new Dictionary<UUID,List<SceneObjectGroup>>(); |
882 | if (obj.OwnerID == m_landData.OwnerID) | 882 | |
883 | { | 883 | lock (primsOverMe) |
884 | if (!returns.ContainsKey(obj.OwnerID)) | 884 | { |
885 | returns[obj.OwnerID] = | 885 | if (type == (uint)ObjectReturnType.Owner) |
886 | new List<SceneObjectGroup>(); | 886 | { |
887 | returns[obj.OwnerID].Add(obj); | 887 | foreach (SceneObjectGroup obj in primsOverMe) |
888 | } | 888 | { |
889 | } | 889 | if (obj.OwnerID == m_landData.OwnerID) |
890 | } | 890 | { |
891 | else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) | 891 | if (!returns.ContainsKey(obj.OwnerID)) |
892 | { | 892 | returns[obj.OwnerID] = |
893 | foreach (SceneObjectGroup obj in primsOverMe) | 893 | new List<SceneObjectGroup>(); |
894 | { | 894 | returns[obj.OwnerID].Add(obj); |
895 | if (obj.GroupID == m_landData.GroupID) | 895 | } |
896 | { | 896 | } |
897 | if (!returns.ContainsKey(obj.OwnerID)) | 897 | } |
898 | returns[obj.OwnerID] = | 898 | else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) |
899 | new List<SceneObjectGroup>(); | 899 | { |
900 | returns[obj.OwnerID].Add(obj); | 900 | foreach (SceneObjectGroup obj in primsOverMe) |
901 | } | 901 | { |
902 | } | 902 | if (obj.GroupID == m_landData.GroupID) |
903 | } | 903 | { |
904 | else if (type == (uint)ObjectReturnType.Other) | 904 | if (!returns.ContainsKey(obj.OwnerID)) |
905 | { | 905 | returns[obj.OwnerID] = |
906 | foreach (SceneObjectGroup obj in primsOverMe) | 906 | new List<SceneObjectGroup>(); |
907 | { | 907 | returns[obj.OwnerID].Add(obj); |
908 | if (obj.OwnerID != m_landData.OwnerID && | 908 | } |
909 | (obj.GroupID != m_landData.GroupID || | 909 | } |
910 | m_landData.GroupID == UUID.Zero)) | 910 | } |
911 | { | 911 | else if (type == (uint)ObjectReturnType.Other) |
912 | if (!returns.ContainsKey(obj.OwnerID)) | 912 | { |
913 | returns[obj.OwnerID] = | 913 | foreach (SceneObjectGroup obj in primsOverMe) |
914 | new List<SceneObjectGroup>(); | 914 | { |
915 | returns[obj.OwnerID].Add(obj); | 915 | if (obj.OwnerID != m_landData.OwnerID && |
916 | } | 916 | (obj.GroupID != m_landData.GroupID || |
917 | } | 917 | m_landData.GroupID == UUID.Zero)) |
918 | } | 918 | { |
919 | else if (type == (uint)ObjectReturnType.List) | 919 | if (!returns.ContainsKey(obj.OwnerID)) |
920 | { | 920 | returns[obj.OwnerID] = |
921 | List<UUID> ownerlist = new List<UUID>(owners); | 921 | new List<SceneObjectGroup>(); |
922 | 922 | returns[obj.OwnerID].Add(obj); | |
923 | foreach (SceneObjectGroup obj in primsOverMe) | 923 | } |
924 | { | 924 | } |
925 | if (ownerlist.Contains(obj.OwnerID)) | 925 | } |
926 | { | 926 | else if (type == (uint)ObjectReturnType.List) |
927 | if (!returns.ContainsKey(obj.OwnerID)) | 927 | { |
928 | returns[obj.OwnerID] = | 928 | List<UUID> ownerlist = new List<UUID>(owners); |
929 | new List<SceneObjectGroup>(); | 929 | |
930 | returns[obj.OwnerID].Add(obj); | 930 | foreach (SceneObjectGroup obj in primsOverMe) |
931 | } | 931 | { |
932 | } | 932 | if (ownerlist.Contains(obj.OwnerID)) |
933 | } | 933 | { |
934 | } | 934 | if (!returns.ContainsKey(obj.OwnerID)) |
935 | 935 | returns[obj.OwnerID] = | |
936 | foreach (List<SceneObjectGroup> ol in returns.Values) | 936 | new List<SceneObjectGroup>(); |
937 | { | 937 | returns[obj.OwnerID].Add(obj); |
938 | if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) | 938 | } |
939 | m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); | 939 | } |
940 | } | 940 | } |
941 | } | 941 | } |
942 | 942 | ||
943 | #endregion | 943 | foreach (List<SceneObjectGroup> ol in returns.Values) |
944 | 944 | { | |
945 | #region Object Adding/Removing from Parcel | 945 | if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) |
946 | 946 | m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); | |
947 | public void ResetLandPrimCounts() | 947 | } |
948 | { | 948 | } |
949 | LandData.GroupPrims = 0; | 949 | |
950 | LandData.OwnerPrims = 0; | 950 | #endregion |
951 | LandData.OtherPrims = 0; | 951 | |
952 | LandData.SelectedPrims = 0; | 952 | #region Object Adding/Removing from Parcel |
953 | 953 | ||
954 | 954 | public void ResetLandPrimCounts() | |
955 | lock (primsOverMe) | 955 | { |
956 | primsOverMe.Clear(); | 956 | LandData.GroupPrims = 0; |
957 | } | 957 | LandData.OwnerPrims = 0; |
958 | 958 | LandData.OtherPrims = 0; | |
959 | public void AddPrimToCount(SceneObjectGroup obj) | 959 | LandData.SelectedPrims = 0; |
960 | { | 960 | |
961 | 961 | ||
962 | UUID prim_owner = obj.OwnerID; | 962 | lock (primsOverMe) |
963 | int prim_count = obj.PrimCount; | 963 | primsOverMe.Clear(); |
964 | 964 | } | |
965 | if (obj.IsSelected) | 965 | |
966 | { | 966 | public void AddPrimToCount(SceneObjectGroup obj) |
967 | LandData.SelectedPrims += prim_count; | 967 | { |
968 | } | 968 | |
969 | else | 969 | UUID prim_owner = obj.OwnerID; |
970 | { | 970 | int prim_count = obj.PrimCount; |
971 | if (prim_owner == LandData.OwnerID) | 971 | |
972 | { | 972 | if (obj.IsSelected) |
973 | LandData.OwnerPrims += prim_count; | 973 | { |
974 | } | 974 | LandData.SelectedPrims += prim_count; |
975 | else if ((obj.GroupID == LandData.GroupID || | 975 | } |
976 | prim_owner == LandData.GroupID) && | 976 | else |
977 | LandData.GroupID != UUID.Zero) | 977 | { |
978 | { | 978 | if (prim_owner == LandData.OwnerID) |
979 | LandData.GroupPrims += prim_count; | 979 | { |
980 | } | 980 | LandData.OwnerPrims += prim_count; |
981 | else | 981 | } |
982 | { | 982 | else if ((obj.GroupID == LandData.GroupID || |
983 | LandData.OtherPrims += prim_count; | 983 | prim_owner == LandData.GroupID) && |
984 | } | 984 | LandData.GroupID != UUID.Zero) |
985 | } | 985 | { |
986 | 986 | LandData.GroupPrims += prim_count; | |
987 | lock (primsOverMe) | 987 | } |
988 | primsOverMe.Add(obj); | 988 | else |
989 | } | 989 | { |
990 | 990 | LandData.OtherPrims += prim_count; | |
991 | public void RemovePrimFromCount(SceneObjectGroup obj) | 991 | } |
992 | { | 992 | } |
993 | lock (primsOverMe) | 993 | |
994 | { | 994 | lock (primsOverMe) |
995 | if (primsOverMe.Contains(obj)) | 995 | primsOverMe.Add(obj); |
996 | { | 996 | } |
997 | UUID prim_owner = obj.OwnerID; | 997 | |
998 | int prim_count = obj.PrimCount; | 998 | public void RemovePrimFromCount(SceneObjectGroup obj) |
999 | 999 | { | |
1000 | if (prim_owner == LandData.OwnerID) | 1000 | lock (primsOverMe) |
1001 | { | 1001 | { |
1002 | LandData.OwnerPrims -= prim_count; | 1002 | if (primsOverMe.Contains(obj)) |
1003 | } | 1003 | { |
1004 | else if (obj.GroupID == LandData.GroupID || | 1004 | UUID prim_owner = obj.OwnerID; |
1005 | prim_owner == LandData.GroupID) | 1005 | int prim_count = obj.PrimCount; |
1006 | { | 1006 | |
1007 | LandData.GroupPrims -= prim_count; | 1007 | if (prim_owner == LandData.OwnerID) |
1008 | } | 1008 | { |
1009 | else | 1009 | LandData.OwnerPrims -= prim_count; |
1010 | { | 1010 | } |
1011 | LandData.OtherPrims -= prim_count; | 1011 | else if (obj.GroupID == LandData.GroupID || |
1012 | } | 1012 | prim_owner == LandData.GroupID) |
1013 | 1013 | { | |
1014 | primsOverMe.Remove(obj); | 1014 | LandData.GroupPrims -= prim_count; |
1015 | } | 1015 | } |
1016 | } | 1016 | else |
1017 | } | 1017 | { |
1018 | 1018 | LandData.OtherPrims -= prim_count; | |
1019 | #endregion | 1019 | } |
1020 | 1020 | ||
1021 | #endregion | 1021 | primsOverMe.Remove(obj); |
1022 | 1022 | } | |
1023 | #endregion | 1023 | } |
1024 | 1024 | } | |
1025 | /// <summary> | 1025 | |
1026 | /// Set the media url for this land parcel | 1026 | #endregion |
1027 | /// </summary> | 1027 | |
1028 | /// <param name="url"></param> | 1028 | #endregion |
1029 | public void SetMediaUrl(string url) | 1029 | |
1030 | { | 1030 | #endregion |
1031 | LandData.MediaURL = url; | 1031 | |
1032 | SendLandUpdateToAvatarsOverMe(); | 1032 | /// <summary> |
1033 | } | 1033 | /// Set the media url for this land parcel |
1034 | 1034 | /// </summary> | |
1035 | /// <summary> | 1035 | /// <param name="url"></param> |
1036 | /// Set the music url for this land parcel | 1036 | public void SetMediaUrl(string url) |
1037 | /// </summary> | 1037 | { |
1038 | /// <param name="url"></param> | 1038 | LandData.MediaURL = url; |
1039 | public void SetMusicUrl(string url) | 1039 | SendLandUpdateToAvatarsOverMe(); |
1040 | { | 1040 | } |
1041 | LandData.MusicURL = url; | 1041 | |
1042 | SendLandUpdateToAvatarsOverMe(); | 1042 | /// <summary> |
1043 | } | 1043 | /// Set the music url for this land parcel |
1044 | } | 1044 | /// </summary> |
1045 | } | 1045 | /// <param name="url"></param> |
1046 | public void SetMusicUrl(string url) | ||
1047 | { | ||
1048 | LandData.MusicURL = url; | ||
1049 | SendLandUpdateToAvatarsOverMe(); | ||
1050 | } | ||
1051 | } | ||
1052 | } | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 62abd4c..8ce6daf 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -128,7 +128,10 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
128 | group.SetOwnerId(remoteClient.AgentId); | 128 | group.SetOwnerId(remoteClient.AgentId); |
129 | group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); | 129 | group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); |
130 | 130 | ||
131 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | 131 | List<SceneObjectPart> partList = null; |
132 | |||
133 | lock (group.Children) | ||
134 | partList = new List<SceneObjectPart>(group.Children.Values); | ||
132 | 135 | ||
133 | if (m_scene.Permissions.PropagatePermissions()) | 136 | if (m_scene.Permissions.PropagatePermissions()) |
134 | { | 137 | { |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index b96d95a..57eff8a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs | |||
@@ -227,8 +227,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
227 | { | 227 | { |
228 | SceneObjectGroup mapdot = (SceneObjectGroup)obj; | 228 | SceneObjectGroup mapdot = (SceneObjectGroup)obj; |
229 | Color mapdotspot = Color.Gray; // Default color when prim color is white | 229 | Color mapdotspot = Color.Gray; // Default color when prim color is white |
230 | // Loop over prim in group | 230 | |
231 | foreach (SceneObjectPart part in mapdot.Children.Values) | 231 | // Loop over prim in group |
232 | List<SceneObjectPart> partList = null; | ||
233 | lock (mapdot.Children) | ||
234 | partList = new List<SceneObjectPart>(mapdot.Children.Values); | ||
235 | |||
236 | foreach (SceneObjectPart part in partList) | ||
232 | { | 237 | { |
233 | if (part == null) | 238 | if (part == null) |
234 | continue; | 239 | continue; |