From 7a61bcff8698b2b1698fa47a9793108baefe2783 Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Tue, 5 Feb 2008 18:27:40 +0000 Subject: [PATCH] Cut down on the number of packets sent during terraforming. Terraforming should be much more responsive. --- .../Terrain.BasicTerrain/TerrainEngine.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 280ca0d3df..f722f12d2b 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -89,6 +89,8 @@ namespace OpenSim.Region.Terrain public DateTime lastEdit = DateTime.Now; + private int counter = 0; + /// /// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine. /// Counts the number of modifications since the last save. (0 = Untainted) @@ -206,7 +208,7 @@ namespace OpenSim.Region.Terrain { FlattenTerrain(y, x, size, (double) seconds/5.0); lastEdit = DateTime.Now; - remoteUser.SendLayerData((int)(x / 16), (int)(x / 16), GetHeights1D()); + //remoteUser.SendLayerData((int)(x / 16), (int)(x / 16), GetHeights1D()); } } @@ -219,7 +221,7 @@ namespace OpenSim.Region.Terrain { RaiseTerrain(y, x, size, (double) seconds/5.0); lastEdit = DateTime.Now; - remoteUser.SendLayerData((int)(x / 16), (int)(x / 16), GetHeights1D()); + //remoteUser.SendLayerData((int)(x / 16), (int)(x / 16), GetHeights1D()); } } break; @@ -231,7 +233,7 @@ namespace OpenSim.Region.Terrain { LowerTerrain(y, x, size, (double) seconds/5.0); lastEdit = DateTime.Now; - remoteUser.SendLayerData((int)(x / 16), (int)(x / 16), GetHeights1D()); + //remoteUser.SendLayerData((int)(x / 16), (int)(x / 16), GetHeights1D()); } } break; @@ -288,17 +290,23 @@ namespace OpenSim.Region.Terrain break; } - for (int x = 0; x < 16; x++) + counter++; + if(counter==3) { - for (int y = 0; y < 16; y++) + counter=0; + for (int x = 0; x < 16; x++) { - if (IsTainted(x*16, y*16)) + for (int y = 0; y < 16; y++) { - remoteUser.SendLayerData(x, y, GetHeights1D()); + if (IsTainted(x*16, y*16)) + { + remoteUser.SendLayerData(x, y, GetHeights1D()); + } } } } + lastEdit = DateTime.Now; return;