diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 956f2b45b9..2f5c5c3a00 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -323,8 +323,8 @@ namespace OpenSim.Region.ClientStack { int[] patches = new int[1]; int patchx, patchy; - patchx = px / 16; - patchy = py / 16; + patchx = px; + patchy = py; patches[0] = patchx + 0 + patchy * 16; diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 126b636cd5..571cead6b6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -58,32 +58,26 @@ namespace OpenSim.Region.Environment.Scenes case 0: // flatten terrain Terrain.FlattenTerrain(north, west, size, (double)seconds / 5.0); - RegenerateTerrain(true, (int)north, (int)west); break; case 1: // raise terrain Terrain.RaiseTerrain(north, west, size, (double)seconds / 5.0); - RegenerateTerrain(true, (int)north, (int)west); break; case 2: //lower terrain Terrain.LowerTerrain(north, west, size, (double)seconds / 5.0); - RegenerateTerrain(true, (int)north, (int)west); break; case 3: // smooth terrain Terrain.SmoothTerrain(north, west, size, (double)seconds / 5.0); - RegenerateTerrain(true, (int)north, (int)west); break; case 4: // noise Terrain.NoiseTerrain(north, west, size, (double)seconds / 5.0); - RegenerateTerrain(true, (int)north, (int)west); break; case 5: // revert Terrain.RevertTerrain(north, west, size, (double)seconds / 5.0); - RegenerateTerrain(true, (int)north, (int)west); break; // CLIENT EXTENSIONS GO HERE @@ -97,6 +91,9 @@ namespace OpenSim.Region.Environment.Scenes // erode-hydraulic break; } + + RegenerateTerrain(true, (int)(north / 16.0f), (int)(west / 16.0f)); + return; } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 81754aea4d..b2ae87d040 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -61,6 +61,7 @@ namespace OpenSim.Region.Environment.Scenes private uint _primCount = 702000; private Mutex _primAllocateMutex = new Mutex(false); private int storageCount; + private int terrainCheckCount; private int landPrimCheckCount; private Mutex updateLock; @@ -235,39 +236,45 @@ namespace OpenSim.Region.Environment.Scenes storageCount = 0; } - if (Terrain.Tainted()) + terrainCheckCount++; + if (terrainCheckCount >= 5) { - lock (Terrain.heightmap) + terrainCheckCount = 0; + + if (Terrain.Tainted()) { - lock (m_syncRoot) + lock (Terrain.heightmap) { - phyScene.SetTerrain(Terrain.GetHeights1D()); - } + lock (m_syncRoot) + { + phyScene.SetTerrain(Terrain.GetHeights1D()); + } - storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); + storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); - float[] terData = Terrain.GetHeights1D(); + float[] terData = Terrain.GetHeights1D(); - ForEachScenePresence(delegate(ScenePresence presence) - { - for (int x = 0; x < 16; x++) + ForEachScenePresence(delegate(ScenePresence presence) { - for (int y = 0; y < 16; y++) + for (int x = 0; x < 16; x++) { - if (Terrain.Tainted(x * 16, y * 16)) + for (int y = 0; y < 16; y++) { - SendLayerData(x, y, presence.ControllingClient, terData); + if (Terrain.Tainted(x * 16, y * 16)) + { + SendLayerData(x, y, presence.ControllingClient, terData); + } } } - } - }); + }); - foreach (LLUUID UUID in Entities.Keys) - { - Entities[UUID].LandRenegerated(); + foreach (LLUUID UUID in Entities.Keys) + { + Entities[UUID].LandRenegerated(); + } + + Terrain.ResetTaint(); } - - Terrain.ResetTaint(); } }