diff options
author | UbitUmarov | 2017-05-13 20:21:56 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-13 20:21:56 +0100 |
commit | 25ca8695f3746b000fee42a0d73b91dfa6a1c9c0 (patch) | |
tree | cd1f5633d3bb1b31fd5685e319953aa9a03cedc0 /OpenSim | |
parent | fix passcollisions bool value on store (diff) | |
download | opensim-SC_OLD-25ca8695f3746b000fee42a0d73b91dfa6a1c9c0.zip opensim-SC_OLD-25ca8695f3746b000fee42a0d73b91dfa6a1c9c0.tar.gz opensim-SC_OLD-25ca8695f3746b000fee42a0d73b91dfa6a1c9c0.tar.bz2 opensim-SC_OLD-25ca8695f3746b000fee42a0d73b91dfa6a1c9c0.tar.xz |
find parcels by GlobalID.. well most time
Diffstat (limited to '')
5 files changed, 65 insertions, 12 deletions
diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 44a24b9..12a8228 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs | |||
@@ -76,6 +76,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
76 | /// <returns></returns> | 76 | /// <returns></returns> |
77 | ILandObject GetLandObject(int localID); | 77 | ILandObject GetLandObject(int localID); |
78 | 78 | ||
79 | ILandObject GetLandObject(UUID GlobalID); | ||
80 | |||
79 | /// <summary> | 81 | /// <summary> |
80 | /// Clear the land channel of all parcels. | 82 | /// Clear the land channel of all parcels. |
81 | /// </summary> | 83 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index 70c6028..5f1eab2 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs | |||
@@ -120,6 +120,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
120 | 120 | ||
121 | public int GetDwell(UUID parcelID) | 121 | public int GetDwell(UUID parcelID) |
122 | { | 122 | { |
123 | ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID); | ||
124 | if (parcel != null && parcel.LandData != null) | ||
125 | return (int)parcel.LandData.Dwell; | ||
123 | return 0; | 126 | return 0; |
124 | } | 127 | } |
125 | } | 128 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index e4c0373..b59e2af 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -106,6 +106,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
106 | return null; | 106 | return null; |
107 | } | 107 | } |
108 | 108 | ||
109 | public ILandObject GetLandObject(UUID GlobalID) | ||
110 | { | ||
111 | if (m_landManagementModule != null) | ||
112 | { | ||
113 | return m_landManagementModule.GetLandObject(GlobalID); | ||
114 | } | ||
115 | return null; | ||
116 | } | ||
117 | |||
109 | public ILandObject GetLandObject(Vector3 position) | 118 | public ILandObject GetLandObject(Vector3 position) |
110 | { | 119 | { |
111 | return GetLandObject(position.X, position.Y); | 120 | return GetLandObject(position.X, position.Y); |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 53b9796..e1f2975 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -92,6 +92,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
92 | 92 | ||
93 | //ubit: removed the readonly so i can move it around | 93 | //ubit: removed the readonly so i can move it around |
94 | private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); | 94 | private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); |
95 | private Dictionary<UUID, int> m_landUUIDList = new Dictionary<UUID, int>(); | ||
95 | 96 | ||
96 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 97 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
97 | 98 | ||
@@ -249,7 +250,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
249 | lock (m_landList) | 250 | lock (m_landList) |
250 | { | 251 | { |
251 | if (m_landList.TryGetValue(local_id, out land)) | 252 | if (m_landList.TryGetValue(local_id, out land)) |
253 | { | ||
252 | land.LandData = newData; | 254 | land.LandData = newData; |
255 | m_landUUIDList[newData.GlobalID] = local_id; | ||
256 | } | ||
253 | } | 257 | } |
254 | 258 | ||
255 | if (land != null) | 259 | if (land != null) |
@@ -271,6 +275,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
271 | lock (m_landList) | 275 | lock (m_landList) |
272 | { | 276 | { |
273 | m_landList.Clear(); | 277 | m_landList.Clear(); |
278 | m_landUUIDList.Clear(); | ||
274 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 279 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
275 | 280 | ||
276 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; | 281 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; |
@@ -434,6 +439,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
434 | if (parcelAvatarIsEntering != null && | 439 | if (parcelAvatarIsEntering != null && |
435 | avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID) | 440 | avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID) |
436 | { | 441 | { |
442 | if(!avatar.IsNPC && avatar.currentParcelUUID != UUID.Zero) | ||
443 | { | ||
444 | ILandObject last = GetLandObject(avatar.currentParcelUUID); | ||
445 | if(last != null) | ||
446 | { | ||
447 | |||
448 | } | ||
449 | } | ||
450 | |||
437 | SendLandUpdate(avatar, parcelAvatarIsEntering); | 451 | SendLandUpdate(avatar, parcelAvatarIsEntering); |
438 | avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID; | 452 | avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID; |
439 | EnforceBans(parcelAvatarIsEntering, avatar); | 453 | EnforceBans(parcelAvatarIsEntering, avatar); |
@@ -656,6 +670,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
656 | } | 670 | } |
657 | 671 | ||
658 | m_landList.Add(newLandLocalID, new_land); | 672 | m_landList.Add(newLandLocalID, new_land); |
673 | m_landUUIDList[new_land.LandData.GlobalID] = newLandLocalID; | ||
659 | m_lastLandLocalID++; | 674 | m_lastLandLocalID++; |
660 | } | 675 | } |
661 | 676 | ||
@@ -690,6 +705,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
690 | 705 | ||
691 | land = m_landList[local_id]; | 706 | land = m_landList[local_id]; |
692 | m_landList.Remove(local_id); | 707 | m_landList.Remove(local_id); |
708 | if(land.LandData != null) | ||
709 | m_landUUIDList.Remove(land.LandData.GlobalID); | ||
693 | } | 710 | } |
694 | 711 | ||
695 | m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); | 712 | m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); |
@@ -745,6 +762,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
745 | UpdateLandObject(master.LandData.LocalID, master.LandData); | 762 | UpdateLandObject(master.LandData.LocalID, master.LandData); |
746 | } | 763 | } |
747 | 764 | ||
765 | public ILandObject GetLandObject(UUID globalID) | ||
766 | { | ||
767 | lock (m_landList) | ||
768 | { | ||
769 | int lid = -1; | ||
770 | if(m_landUUIDList.TryGetValue(globalID, out lid) && lid >= 0) | ||
771 | { | ||
772 | if (m_landList.ContainsKey(lid)) | ||
773 | { | ||
774 | return m_landList[lid]; | ||
775 | } | ||
776 | else | ||
777 | m_landUUIDList.Remove(globalID); // auto heal | ||
778 | } | ||
779 | } | ||
780 | return null; | ||
781 | } | ||
782 | |||
748 | public ILandObject GetLandObject(int parcelLocalID) | 783 | public ILandObject GetLandObject(int parcelLocalID) |
749 | { | 784 | { |
750 | lock (m_landList) | 785 | lock (m_landList) |
@@ -1351,7 +1386,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1351 | 1386 | ||
1352 | public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client) | 1387 | public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client) |
1353 | { | 1388 | { |
1354 | ILandObject land; | 1389 | ILandObject land = null; |
1355 | lock (m_landList) | 1390 | lock (m_landList) |
1356 | { | 1391 | { |
1357 | m_landList.TryGetValue(local_id, out land); | 1392 | m_landList.TryGetValue(local_id, out land); |
@@ -1360,7 +1395,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1360 | if (land != null) | 1395 | if (land != null) |
1361 | { | 1396 | { |
1362 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 1397 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
1363 | m_landList[local_id].SendLandObjectOwners(remote_client); | 1398 | land.SendLandObjectOwners(remote_client); |
1364 | } | 1399 | } |
1365 | else | 1400 | else |
1366 | { | 1401 | { |
@@ -1370,7 +1405,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1370 | 1405 | ||
1371 | public void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client) | 1406 | public void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client) |
1372 | { | 1407 | { |
1373 | ILandObject land; | 1408 | ILandObject land = null; |
1374 | lock (m_landList) | 1409 | lock (m_landList) |
1375 | { | 1410 | { |
1376 | m_landList.TryGetValue(local_id, out land); | 1411 | m_landList.TryGetValue(local_id, out land); |
@@ -1393,7 +1428,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1393 | 1428 | ||
1394 | public void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client) | 1429 | public void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client) |
1395 | { | 1430 | { |
1396 | ILandObject land; | 1431 | ILandObject land = null; |
1397 | lock (m_landList) | 1432 | lock (m_landList) |
1398 | { | 1433 | { |
1399 | m_landList.TryGetValue(local_id, out land); | 1434 | m_landList.TryGetValue(local_id, out land); |
@@ -1417,7 +1452,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1417 | 1452 | ||
1418 | public void ClientOnParcelReclaim(int local_id, IClientAPI remote_client) | 1453 | public void ClientOnParcelReclaim(int local_id, IClientAPI remote_client) |
1419 | { | 1454 | { |
1420 | ILandObject land; | 1455 | ILandObject land = null; |
1421 | lock (m_landList) | 1456 | lock (m_landList) |
1422 | { | 1457 | { |
1423 | m_landList.TryGetValue(local_id, out land); | 1458 | m_landList.TryGetValue(local_id, out land); |
@@ -1503,17 +1538,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1503 | 1538 | ||
1504 | void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) | 1539 | void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) |
1505 | { | 1540 | { |
1506 | ILandObject land; | 1541 | ILandObject land = null; |
1507 | lock (m_landList) | 1542 | lock (m_landList) |
1508 | { | 1543 | { |
1509 | m_landList.TryGetValue(parcelLocalID, out land); | 1544 | m_landList.TryGetValue(parcelLocalID, out land); |
1510 | } | 1545 | } |
1511 | 1546 | ||
1512 | if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land)) | ||
1513 | return; | ||
1514 | |||
1515 | if (land != null) | 1547 | if (land != null) |
1516 | { | 1548 | { |
1549 | if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land)) | ||
1550 | return; | ||
1517 | land.DeedToGroup(groupID); | 1551 | land.DeedToGroup(groupID); |
1518 | } | 1552 | } |
1519 | } | 1553 | } |
@@ -1763,7 +1797,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1763 | land_update.GroupAVSounds = true; | 1797 | land_update.GroupAVSounds = true; |
1764 | } | 1798 | } |
1765 | 1799 | ||
1766 | ILandObject land; | 1800 | ILandObject land = null; |
1767 | lock (m_landList) | 1801 | lock (m_landList) |
1768 | { | 1802 | { |
1769 | m_landList.TryGetValue(parcelID, out land); | 1803 | m_landList.TryGetValue(parcelID, out land); |
@@ -1951,7 +1985,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1951 | 1985 | ||
1952 | public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) | 1986 | public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) |
1953 | { | 1987 | { |
1954 | ILandObject land; | 1988 | ILandObject land = null; |
1955 | lock (m_landList) | 1989 | lock (m_landList) |
1956 | { | 1990 | { |
1957 | m_landList.TryGetValue(localID, out land); | 1991 | m_landList.TryGetValue(localID, out land); |
@@ -2248,7 +2282,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2248 | if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId)) | 2282 | if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId)) |
2249 | return; | 2283 | return; |
2250 | 2284 | ||
2251 | ILandObject lo; | 2285 | ILandObject lo = null; |
2252 | 2286 | ||
2253 | lock (m_landList) | 2287 | lock (m_landList) |
2254 | { | 2288 | { |
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 3d44a33..48dc840 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs | |||
@@ -96,6 +96,11 @@ namespace OpenSim.Tests.Common | |||
96 | return GetNoLand(); | 96 | return GetNoLand(); |
97 | } | 97 | } |
98 | 98 | ||
99 | public ILandObject GetLandObject(UUID ID) | ||
100 | { | ||
101 | return GetNoLand(); | ||
102 | } | ||
103 | |||
99 | public ILandObject GetLandObject(float x, float y) | 104 | public ILandObject GetLandObject(float x, float y) |
100 | { | 105 | { |
101 | return GetNoLand(); | 106 | return GetNoLand(); |