From 5d42d244286472077123cf1ca0e781d2c0c57e48 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 Aug 2016 02:10:45 +0100 Subject: [PATCH] limit the scan of terrain EnforceEstateLimits to the area changed. --- .../World/Terrain/TerrainModule.cs | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 275aa2ab99..05d18da187 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -963,6 +963,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain return wasLimited; } + private bool EnforceEstateLimits(int startX, int startY, int endX, int endY) + { + TerrainData terrData = m_channel.GetTerrainData(); + + bool wasLimited = false; + for (int x = startX; x <= endX; x += Constants.TerrainPatchSize) + { + for (int y = startX; y <= endY; y += Constants.TerrainPatchSize) + { + if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) + { + // If we should respect the estate settings then + // fixup and height deltas that don't respect them. + // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. + wasLimited |= LimitChannelChanges(terrData, x, y); + } + } + } + return wasLimited; + } + /// /// Checks to see height deltas in the tainted terrain patch at xStart ,yStart /// are all within the current estate limits @@ -1341,7 +1362,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain //block changes outside estate limits if (!god) - EnforceEstateLimits(); + EnforceEstateLimits(startX, endX, startY, endY); } } else @@ -1404,7 +1425,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain //block changes outside estate limits if (!god) - EnforceEstateLimits(); + EnforceEstateLimits(startX, endX, startY, endY); } } else