diff options
author | UbitUmarov | 2014-07-30 14:53:56 +0100 |
---|---|---|
committer | UbitUmarov | 2014-07-30 14:53:56 +0100 |
commit | 5fe1f878372b5490304a2ad7c0a41293ae36aaa0 (patch) | |
tree | b9c63b3d0f16031492cd614af6a0135d2d2ee5bd /OpenSim/Region/CoreModules/World/Land | |
parent | Persist new land fields for access control (diff) | |
download | opensim-SC-5fe1f878372b5490304a2ad7c0a41293ae36aaa0.zip opensim-SC-5fe1f878372b5490304a2ad7c0a41293ae36aaa0.tar.gz opensim-SC-5fe1f878372b5490304a2ad7c0a41293ae36aaa0.tar.bz2 opensim-SC-5fe1f878372b5490304a2ad7c0a41293ae36aaa0.tar.xz |
changes to parcels code (still more to to)
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 137 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 74 |
2 files changed, 134 insertions, 77 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d3866fc..c444c29 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -198,8 +198,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
198 | EntityBase presenceEntity; | 198 | EntityBase presenceEntity; |
199 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | 199 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) |
200 | { | 200 | { |
201 | SendLandUpdate((ScenePresence)presenceEntity, true); | ||
202 | SendParcelOverlay(client); | 201 | SendParcelOverlay(client); |
202 | SendLandUpdate((ScenePresence)presenceEntity, true); | ||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
@@ -233,8 +233,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
233 | public void UpdateLandObject(int local_id, LandData data) | 233 | public void UpdateLandObject(int local_id, LandData data) |
234 | { | 234 | { |
235 | LandData newData = data.Copy(); | 235 | LandData newData = data.Copy(); |
236 | newData.LocalID = local_id; | 236 | newData.LocalID = local_id; |
237 | ILandObject landobj = null; | ||
238 | 237 | ||
239 | ILandObject land; | 238 | ILandObject land; |
240 | lock (m_landList) | 239 | lock (m_landList) |
@@ -388,40 +387,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
388 | 387 | ||
389 | public void SendLandUpdate(ScenePresence avatar, bool force) | 388 | public void SendLandUpdate(ScenePresence avatar, bool force) |
390 | { | 389 | { |
391 | |||
392 | /* stop sendind same data twice | ||
393 | ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | ||
394 | (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | ||
395 | |||
396 | if (over != null) | ||
397 | { | ||
398 | |||
399 | if (force) | ||
400 | { | ||
401 | if (!avatar.IsChildAgent) | ||
402 | { | ||
403 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
404 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | ||
405 | m_scene.RegionInfo.RegionID); | ||
406 | } | ||
407 | } | ||
408 | |||
409 | if (avatar.currentParcelUUID != over.LandData.GlobalID) | ||
410 | { | ||
411 | if (!avatar.IsChildAgent) | ||
412 | { | ||
413 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
414 | avatar.currentParcelUUID = over.LandData.GlobalID; | ||
415 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | ||
416 | m_scene.RegionInfo.RegionID); | ||
417 | } | ||
418 | } | ||
419 | */ | ||
420 | if (avatar.IsChildAgent) | 390 | if (avatar.IsChildAgent) |
421 | return; | 391 | return; |
422 | 392 | ||
423 | ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | 393 | ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X,avatar.AbsolutePosition.Y); |
424 | (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | ||
425 | 394 | ||
426 | if (over != null) | 395 | if (over != null) |
427 | { | 396 | { |
@@ -740,6 +709,36 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
740 | } | 709 | } |
741 | } | 710 | } |
742 | 711 | ||
712 | // if x,y is off region this will return the parcel at cliped x,y | ||
713 | // as did code it replaces | ||
714 | public ILandObject GetLandObjectClipedXY(float x, float y) | ||
715 | { | ||
716 | //do clip inline | ||
717 | int avx = (int)x; | ||
718 | if (avx < 0) | ||
719 | avx = 0; | ||
720 | else if (avx >= (int)Constants.RegionSize) | ||
721 | avx = (int)Constants.RegionSize - 1; | ||
722 | |||
723 | int avy = (int)y; | ||
724 | if (avy < 0) | ||
725 | avy = 0; | ||
726 | else if (avy >= (int)Constants.RegionSize) | ||
727 | avy = (int)Constants.RegionSize - 1; | ||
728 | |||
729 | lock (m_landIDList) | ||
730 | { | ||
731 | try | ||
732 | { | ||
733 | return m_landList[m_landIDList[avx / 4, avy / 4]]; | ||
734 | } | ||
735 | catch (IndexOutOfRangeException) | ||
736 | { | ||
737 | return null; | ||
738 | } | ||
739 | } | ||
740 | } | ||
741 | |||
743 | public ILandObject GetLandObject(int x, int y) | 742 | public ILandObject GetLandObject(int x, int y) |
744 | { | 743 | { |
745 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) | 744 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) |
@@ -935,7 +934,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
935 | //Now add the new land object | 934 | //Now add the new land object |
936 | ILandObject result = AddLandObject(newLand); | 935 | ILandObject result = AddLandObject(newLand); |
937 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); | 936 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); |
937 | m_scene.ForEachClient(SendParcelOverlay); | ||
938 | result.SendLandUpdateToAvatarsOverMe(); | 938 | result.SendLandUpdateToAvatarsOverMe(); |
939 | |||
939 | } | 940 | } |
940 | 941 | ||
941 | /// <summary> | 942 | /// <summary> |
@@ -999,6 +1000,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
999 | } | 1000 | } |
1000 | } | 1001 | } |
1001 | 1002 | ||
1003 | m_scene.ForEachClient(SendParcelOverlay); | ||
1002 | masterLandObject.SendLandUpdateToAvatarsOverMe(); | 1004 | masterLandObject.SendLandUpdateToAvatarsOverMe(); |
1003 | } | 1005 | } |
1004 | 1006 | ||
@@ -1016,6 +1018,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1016 | 1018 | ||
1017 | #region Parcel Updating | 1019 | #region Parcel Updating |
1018 | 1020 | ||
1021 | |||
1019 | /// <summary> | 1022 | /// <summary> |
1020 | /// Where we send the ParcelOverlay packet to the client | 1023 | /// Where we send the ParcelOverlay packet to the client |
1021 | /// </summary> | 1024 | /// </summary> |
@@ -1027,16 +1030,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1027 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 1030 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; |
1028 | int byteArrayCount = 0; | 1031 | int byteArrayCount = 0; |
1029 | int sequenceID = 0; | 1032 | int sequenceID = 0; |
1030 | int blockmeters = 4 * (int) Constants.RegionSize/(int)Constants.TerrainPatchSize; | ||
1031 | 1033 | ||
1032 | 1034 | for (int y = 0; y < Constants.RegionSize; y += 4) | |
1033 | for (int y = 0; y < blockmeters; y++) | ||
1034 | { | 1035 | { |
1035 | for (int x = 0; x < blockmeters; x++) | 1036 | for (int x = 0; x < Constants.RegionSize; x += 4) |
1036 | { | 1037 | { |
1037 | byte tempByte = 0; //This represents the byte for the current 4x4 | 1038 | byte tempByte = 0; //This represents the byte for the current 4x4 |
1038 | 1039 | ||
1039 | ILandObject currentParcelBlock = GetLandObject(x * 4, y * 4); | 1040 | ILandObject currentParcelBlock = GetLandObject(x, y); |
1040 | 1041 | ||
1041 | if (currentParcelBlock != null) | 1042 | if (currentParcelBlock != null) |
1042 | { | 1043 | { |
@@ -1076,11 +1077,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1076 | ILandObject southParcel = null; | 1077 | ILandObject southParcel = null; |
1077 | if (x > 0) | 1078 | if (x > 0) |
1078 | { | 1079 | { |
1079 | westParcel = GetLandObject((x - 1) * 4, y * 4); | 1080 | westParcel = GetLandObject((x - 1), y); |
1080 | } | 1081 | } |
1081 | if (y > 0) | 1082 | if (y > 0) |
1082 | { | 1083 | { |
1083 | southParcel = GetLandObject(x * 4, (y - 1) * 4); | 1084 | southParcel = GetLandObject(x, (y - 1)); |
1084 | } | 1085 | } |
1085 | 1086 | ||
1086 | if (x == 0) | 1087 | if (x == 0) |
@@ -1106,8 +1107,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1106 | tempByte |= (byte)LandChannel.LAND_FLAG_LOCALSOUND; | 1107 | tempByte |= (byte)LandChannel.LAND_FLAG_LOCALSOUND; |
1107 | 1108 | ||
1108 | // hide avatars | 1109 | // hide avatars |
1109 | // if ((currentParcelBlock.LandData.Flags & (uint)ParcelFlags.???hideavatar) != 0) | 1110 | if (!currentParcelBlock.LandData.SeeAVs) |
1110 | // tempByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS; | 1111 | tempByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS; |
1111 | 1112 | ||
1112 | 1113 | ||
1113 | byteArray[byteArrayCount] = tempByte; | 1114 | byteArray[byteArrayCount] = tempByte; |
@@ -1165,6 +1166,36 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1165 | SendParcelOverlay(remote_client); | 1166 | SendParcelOverlay(remote_client); |
1166 | } | 1167 | } |
1167 | 1168 | ||
1169 | public void UpdateLandProperties(ILandObject land, LandUpdateArgs args, IClientAPI remote_client) | ||
1170 | { | ||
1171 | bool snap_selection = false; | ||
1172 | bool needOverlay = false; | ||
1173 | if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay)) | ||
1174 | { | ||
1175 | //parcel | ||
1176 | |||
1177 | land.SendLandProperties(-10000, true, LandChannel.LAND_RESULT_SINGLE, remote_client); | ||
1178 | |||
1179 | if (needOverlay) | ||
1180 | { | ||
1181 | m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar) | ||
1182 | { | ||
1183 | if (avatar.IsChildAgent) | ||
1184 | return; | ||
1185 | |||
1186 | IClientAPI client = avatar.ControllingClient; | ||
1187 | SendParcelOverlay(client); | ||
1188 | ILandObject aland = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | ||
1189 | if (aland != null) | ||
1190 | { | ||
1191 | if (client != remote_client || land != aland) | ||
1192 | aland.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, client); | ||
1193 | } | ||
1194 | }); | ||
1195 | } | ||
1196 | } | ||
1197 | } | ||
1198 | |||
1168 | public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) | 1199 | public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) |
1169 | { | 1200 | { |
1170 | ILandObject land; | 1201 | ILandObject land; |
@@ -1175,7 +1206,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1175 | 1206 | ||
1176 | if (land != null) | 1207 | if (land != null) |
1177 | { | 1208 | { |
1178 | land.UpdateLandProperties(args, remote_client); | 1209 | UpdateLandProperties(land, args, remote_client); |
1179 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client); | 1210 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client); |
1180 | } | 1211 | } |
1181 | } | 1212 | } |
@@ -1231,7 +1262,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1231 | land.LandData.GroupID = UUID.Zero; | 1262 | land.LandData.GroupID = UUID.Zero; |
1232 | land.LandData.IsGroupOwned = false; | 1263 | land.LandData.IsGroupOwned = false; |
1233 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 1264 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
1234 | |||
1235 | m_scene.ForEachClient(SendParcelOverlay); | 1265 | m_scene.ForEachClient(SendParcelOverlay); |
1236 | land.SendLandUpdateToClient(true, remote_client); | 1266 | land.SendLandUpdateToClient(true, remote_client); |
1237 | } | 1267 | } |
@@ -1279,7 +1309,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1279 | land.LandData.SalePrice = 0; | 1309 | land.LandData.SalePrice = 0; |
1280 | land.LandData.AuthBuyerID = UUID.Zero; | 1310 | land.LandData.AuthBuyerID = UUID.Zero; |
1281 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 1311 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
1282 | |||
1283 | m_scene.ForEachClient(SendParcelOverlay); | 1312 | m_scene.ForEachClient(SendParcelOverlay); |
1284 | land.SendLandUpdateToClient(true, remote_client); | 1313 | land.SendLandUpdateToClient(true, remote_client); |
1285 | } | 1314 | } |
@@ -1574,13 +1603,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1574 | 1603 | ||
1575 | if (land != null) | 1604 | if (land != null) |
1576 | { | 1605 | { |
1577 | land.UpdateLandProperties(land_update, client); | 1606 | UpdateLandProperties(land,land_update, client); |
1578 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); | 1607 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); |
1579 | } | 1608 | } |
1580 | else | 1609 | else |
1581 | { | 1610 | { |
1582 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); | 1611 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); |
1583 | } | 1612 | } |
1613 | |||
1584 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | 1614 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); |
1585 | } | 1615 | } |
1586 | // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the | 1616 | // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the |
@@ -2033,8 +2063,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2033 | "Parcel Name", | 2063 | "Parcel Name", |
2034 | "Local ID", | 2064 | "Local ID", |
2035 | "Area", | 2065 | "Area", |
2036 | "Starts", | 2066 | "AABBMin", |
2037 | "Ends", | 2067 | "AABBMax", |
2038 | "Owner"); | 2068 | "Owner"); |
2039 | 2069 | ||
2040 | lock (m_landList) | 2070 | lock (m_landList) |
@@ -2045,11 +2075,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2045 | 2075 | ||
2046 | report.AppendFormat( | 2076 | report.AppendFormat( |
2047 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", | 2077 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", |
2048 | ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); | 2078 | ld.Name, ld.LocalID, ld.Area, ld.AABBMin, ld.AABBMax, m_userManager.GetUserName(ld.OwnerID)); |
2049 | } | 2079 | } |
2050 | } | 2080 | } |
2051 | 2081 | ||
2052 | MainConsole.Instance.Output(report.ToString()); | ||
2053 | } | 2082 | } |
2054 | 2083 | ||
2055 | public void EnforceBans(ILandObject land, ScenePresence avatar) | 2084 | public void EnforceBans(ILandObject land, ScenePresence avatar) |
@@ -2084,8 +2113,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2084 | cdl.AddRow("Description", ld.Description); | 2113 | cdl.AddRow("Description", ld.Description); |
2085 | cdl.AddRow("Snapshot ID", ld.SnapshotID); | 2114 | cdl.AddRow("Snapshot ID", ld.SnapshotID); |
2086 | cdl.AddRow("Area", ld.Area); | 2115 | cdl.AddRow("Area", ld.Area); |
2087 | cdl.AddRow("Starts", lo.StartPoint); | ||
2088 | cdl.AddRow("Ends", lo.EndPoint); | ||
2089 | cdl.AddRow("AABB Min", ld.AABBMin); | 2116 | cdl.AddRow("AABB Min", ld.AABBMin); |
2090 | cdl.AddRow("AABB Max", ld.AABBMax); | 2117 | cdl.AddRow("AABB Max", ld.AABBMax); |
2091 | 2118 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index cf37e09..7de6365 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -267,10 +267,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
267 | GetSimulatorMaxPrimCount(), regionFlags); | 267 | GetSimulatorMaxPrimCount(), regionFlags); |
268 | } | 268 | } |
269 | 269 | ||
270 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) | 270 | public bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay) |
271 | { | 271 | { |
272 | //Needs later group support | 272 | //Needs later group support |
273 | bool snap_selection = false; | 273 | snap_selection = false; |
274 | needOverlay = false; | ||
274 | LandData newData = LandData.Copy(); | 275 | LandData newData = LandData.Copy(); |
275 | 276 | ||
276 | uint allowedDelta = 0; | 277 | uint allowedDelta = 0; |
@@ -390,9 +391,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
390 | uint preserve = LandData.Flags & ~allowedDelta; | 391 | uint preserve = LandData.Flags & ~allowedDelta; |
391 | newData.Flags = preserve | (args.ParcelFlags & allowedDelta); | 392 | newData.Flags = preserve | (args.ParcelFlags & allowedDelta); |
392 | 393 | ||
394 | uint curdelta = LandData.Flags ^ newData.Flags; | ||
395 | curdelta &= (uint)(ParcelFlags.SoundLocal); | ||
396 | |||
397 | if(curdelta != 0 || newData.SeeAVs != LandData.SeeAVs) | ||
398 | needOverlay = true; | ||
399 | |||
393 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 400 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
394 | SendLandUpdateToAvatarsOverMe(snap_selection); | 401 | return true; |
395 | } | 402 | } |
403 | return false; | ||
396 | } | 404 | } |
397 | 405 | ||
398 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) | 406 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) |
@@ -408,7 +416,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
408 | newData.AuthBuyerID = UUID.Zero; | 416 | newData.AuthBuyerID = UUID.Zero; |
409 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 417 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
410 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 418 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
411 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 419 | // m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
412 | SendLandUpdateToAvatarsOverMe(true); | 420 | SendLandUpdateToAvatarsOverMe(true); |
413 | } | 421 | } |
414 | 422 | ||
@@ -579,6 +587,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
579 | 587 | ||
580 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) | 588 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) |
581 | { | 589 | { |
590 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | ||
582 | m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar) | 591 | m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar) |
583 | { | 592 | { |
584 | ILandObject over = null; | 593 | ILandObject over = null; |
@@ -733,10 +742,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
733 | /// </summary> | 742 | /// </summary> |
734 | private void UpdateAABBAndAreaValues() | 743 | private void UpdateAABBAndAreaValues() |
735 | { | 744 | { |
736 | int min_x = 64; | 745 | int min_x = Int32.MaxValue; |
737 | int min_y = 64; | 746 | int min_y = Int32.MaxValue; |
738 | int max_x = 0; | 747 | int max_x = Int32.MinValue; |
739 | int max_y = 0; | 748 | int max_y = Int32.MinValue; |
740 | int tempArea = 0; | 749 | int tempArea = 0; |
741 | int x, y; | 750 | int x, y; |
742 | for (x = 0; x < 64; x++) | 751 | for (x = 0; x < 64; x++) |
@@ -745,35 +754,56 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
745 | { | 754 | { |
746 | if (LandBitmap[x, y] == true) | 755 | if (LandBitmap[x, y] == true) |
747 | { | 756 | { |
748 | if (min_x > x) min_x = x; | 757 | if (min_x > x) |
749 | if (min_y > y) min_y = y; | 758 | min_x = x; |
750 | if (max_x < x) max_x = x; | 759 | if (min_y > y) |
751 | if (max_y < y) max_y = y; | 760 | min_y = y; |
761 | if (max_x < x) | ||
762 | max_x = x; | ||
763 | if (max_y < y) | ||
764 | max_y = y; | ||
752 | tempArea += 16; //16sqm peice of land | 765 | tempArea += 16; //16sqm peice of land |
753 | } | 766 | } |
754 | } | 767 | } |
755 | } | 768 | } |
769 | |||
756 | int tx = min_x * 4; | 770 | int tx = min_x * 4; |
757 | if (tx > ((int)Constants.RegionSize - 1)) | 771 | int htx; |
758 | tx = ((int)Constants.RegionSize - 1); | 772 | if (tx == ((int)Constants.RegionSize)) |
773 | htx = tx - 1; | ||
774 | else | ||
775 | htx = tx; | ||
776 | |||
759 | int ty = min_y * 4; | 777 | int ty = min_y * 4; |
760 | if (ty > ((int)Constants.RegionSize - 1)) | 778 | int hty; |
761 | ty = ((int)Constants.RegionSize - 1); | 779 | |
780 | if (ty == ((int)Constants.RegionSize)) | ||
781 | hty = ty - 1; | ||
782 | else | ||
783 | hty = ty; | ||
762 | 784 | ||
763 | LandData.AABBMin = | 785 | LandData.AABBMin = |
764 | new Vector3( | 786 | new Vector3( |
765 | (float)(min_x * 4), (float)(min_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); | 787 | (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); |
766 | 788 | ||
789 | max_x++; | ||
767 | tx = max_x * 4; | 790 | tx = max_x * 4; |
768 | if (tx > ((int)Constants.RegionSize - 1)) | 791 | if (tx == ((int)Constants.RegionSize)) |
769 | tx = ((int)Constants.RegionSize - 1); | 792 | htx = tx - 1; |
793 | else | ||
794 | htx = tx; | ||
795 | |||
796 | max_y++; | ||
770 | ty = max_y * 4; | 797 | ty = max_y * 4; |
771 | if (ty > ((int)Constants.RegionSize - 1)) | 798 | |
772 | ty = ((int)Constants.RegionSize - 1); | 799 | if (ty == ((int)Constants.RegionSize)) |
800 | hty = ty - 1; | ||
801 | else | ||
802 | hty = ty; | ||
773 | 803 | ||
774 | LandData.AABBMax | 804 | LandData.AABBMax |
775 | = new Vector3( | 805 | = new Vector3( |
776 | (float)(max_x * 4), (float)(max_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); | 806 | (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); |
777 | 807 | ||
778 | LandData.Area = tempArea; | 808 | LandData.Area = tempArea; |
779 | } | 809 | } |