aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs47
2 files changed, 30 insertions, 26 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 126b636..571cead 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
58 case 0: 58 case 0:
59 // flatten terrain 59 // flatten terrain
60 Terrain.FlattenTerrain(north, west, size, (double)seconds / 5.0); 60 Terrain.FlattenTerrain(north, west, size, (double)seconds / 5.0);
61 RegenerateTerrain(true, (int)north, (int)west);
62 break; 61 break;
63 case 1: 62 case 1:
64 // raise terrain 63 // raise terrain
65 Terrain.RaiseTerrain(north, west, size, (double)seconds / 5.0); 64 Terrain.RaiseTerrain(north, west, size, (double)seconds / 5.0);
66 RegenerateTerrain(true, (int)north, (int)west);
67 break; 65 break;
68 case 2: 66 case 2:
69 //lower terrain 67 //lower terrain
70 Terrain.LowerTerrain(north, west, size, (double)seconds / 5.0); 68 Terrain.LowerTerrain(north, west, size, (double)seconds / 5.0);
71 RegenerateTerrain(true, (int)north, (int)west);
72 break; 69 break;
73 case 3: 70 case 3:
74 // smooth terrain 71 // smooth terrain
75 Terrain.SmoothTerrain(north, west, size, (double)seconds / 5.0); 72 Terrain.SmoothTerrain(north, west, size, (double)seconds / 5.0);
76 RegenerateTerrain(true, (int)north, (int)west);
77 break; 73 break;
78 case 4: 74 case 4:
79 // noise 75 // noise
80 Terrain.NoiseTerrain(north, west, size, (double)seconds / 5.0); 76 Terrain.NoiseTerrain(north, west, size, (double)seconds / 5.0);
81 RegenerateTerrain(true, (int)north, (int)west);
82 break; 77 break;
83 case 5: 78 case 5:
84 // revert 79 // revert
85 Terrain.RevertTerrain(north, west, size, (double)seconds / 5.0); 80 Terrain.RevertTerrain(north, west, size, (double)seconds / 5.0);
86 RegenerateTerrain(true, (int)north, (int)west);
87 break; 81 break;
88 82
89 // CLIENT EXTENSIONS GO HERE 83 // CLIENT EXTENSIONS GO HERE
@@ -97,6 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
97 // erode-hydraulic 91 // erode-hydraulic
98 break; 92 break;
99 } 93 }
94
95 RegenerateTerrain(true, (int)(north / 16.0f), (int)(west / 16.0f));
96
100 return; 97 return;
101 } 98 }
102 99
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