aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs47
1 files changed, 27 insertions, 20 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 81754ae..b2ae87d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Region.Environment.Scenes
61 private uint _primCount = 702000; 61 private uint _primCount = 702000;
62 private Mutex _primAllocateMutex = new Mutex(false); 62 private Mutex _primAllocateMutex = new Mutex(false);
63 private int storageCount; 63 private int storageCount;
64 private int terrainCheckCount;
64 private int landPrimCheckCount; 65 private int landPrimCheckCount;
65 private Mutex updateLock; 66 private Mutex updateLock;
66 67
@@ -235,39 +236,45 @@ namespace OpenSim.Region.Environment.Scenes
235 storageCount = 0; 236 storageCount = 0;
236 } 237 }
237 238
238 if (Terrain.Tainted()) 239 terrainCheckCount++;
240 if (terrainCheckCount >= 5)
239 { 241 {
240 lock (Terrain.heightmap) 242 terrainCheckCount = 0;
243
244 if (Terrain.Tainted())
241 { 245 {
242 lock (m_syncRoot) 246 lock (Terrain.heightmap)
243 { 247 {
244 phyScene.SetTerrain(Terrain.GetHeights1D()); 248 lock (m_syncRoot)
245 } 249 {
250 phyScene.SetTerrain(Terrain.GetHeights1D());
251 }
246 252
247 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 253 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
248 254
249 float[] terData = Terrain.GetHeights1D(); 255 float[] terData = Terrain.GetHeights1D();
250 256
251 ForEachScenePresence(delegate(ScenePresence presence) 257 ForEachScenePresence(delegate(ScenePresence presence)
252 {
253 for (int x = 0; x < 16; x++)
254 { 258 {
255 for (int y = 0; y < 16; y++) 259 for (int x = 0; x < 16; x++)
256 { 260 {
257 if (Terrain.Tainted(x * 16, y * 16)) 261 for (int y = 0; y < 16; y++)
258 { 262 {
259 SendLayerData(x, y, presence.ControllingClient, terData); 263 if (Terrain.Tainted(x * 16, y * 16))
264 {
265 SendLayerData(x, y, presence.ControllingClient, terData);
266 }
260 } 267 }
261 } 268 }
262 } 269 });
263 });
264 270
265 foreach (LLUUID UUID in Entities.Keys) 271 foreach (LLUUID UUID in Entities.Keys)
266 { 272 {
267 Entities[UUID].LandRenegerated(); 273 Entities[UUID].LandRenegerated();
268 } 274 }
269 275
270 Terrain.ResetTaint(); 276 Terrain.ResetTaint();
277 }
271 } 278 }
272 } 279 }
273 280