aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs19
1 files changed, 9 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
index e036988..dae4cf8 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
@@ -35,20 +35,20 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
35 /// </summary> 35 /// </summary>
36 public class ErodeSphere : ITerrainPaintableEffect 36 public class ErodeSphere : ITerrainPaintableEffect
37 { 37 {
38 private double rainHeight = 0.2; 38 private const double rainHeight = 0.2;
39 private int rounds = 10; 39 private const int rounds = 10;
40 private NeighbourSystem type = NeighbourSystem.Moore; // Parameter 40 private const NeighbourSystem type = NeighbourSystem.Moore;
41 private double waterSaturation = 0.30; // Can carry 1% of water in height 41 private const double waterSaturation = 0.30;
42 42
43 #region Supporting Functions 43 #region Supporting Functions
44 44
45 private int[] Neighbours(NeighbourSystem type, int index) 45 private static int[] Neighbours(NeighbourSystem neighbourType, int index)
46 { 46 {
47 int[] coord = new int[2]; 47 int[] coord = new int[2];
48 48
49 index++; 49 index++;
50 50
51 switch (type) 51 switch (neighbourType)
52 { 52 {
53 case NeighbourSystem.Moore: 53 case NeighbourSystem.Moore:
54 switch (index) 54 switch (index)
@@ -173,7 +173,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
173 { 173 {
174 for (y = 0; y < water.Height; y++) 174 for (y = 0; y < water.Height; y++)
175 { 175 {
176 double solConst = (1.0 / rounds); 176 const double solConst = (1.0 / rounds);
177 double sedDelta = water[x, y] * solConst; 177 double sedDelta = water[x, y] * solConst;
178 map[x, y] -= sedDelta; 178 map[x, y] -= sedDelta;
179 sediment[x, y] += sedDelta; 179 sediment[x, y] += sedDelta;
@@ -194,9 +194,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
194 double altitudeTotal = 0.0; 194 double altitudeTotal = 0.0;
195 double altitudeMe = map[x, y] + water[x, y]; 195 double altitudeMe = map[x, y] + water[x, y];
196 196
197 int NEIGHBOUR_ME = 4; 197 const int NEIGHBOUR_ME = 4;
198 198 const int NEIGHBOUR_MAX = 9;
199 int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5;
200 199
201 for (int j = 0; j < NEIGHBOUR_MAX; j++) 200 for (int j = 0; j < NEIGHBOUR_MAX; j++)
202 { 201 {