terraforming changes: make jenkis happy

0.9.1.1
UbitUmarov 2019-11-10 00:47:40 +00:00
parent 727216044b
commit f6ea22647d
4 changed files with 12 additions and 12 deletions

View File

@ -37,15 +37,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
int startX, int endX, int startY, int endY) int startX, int endX, int startY, int endY)
{ {
int x,y; int x,y;
for (x = startX; x <= endX; x++) for (x = startX; x <= endX; ++x)
{ {
for (y = startY; y <= endY; y++) for (y = startY; y <= endY; ++y)
{ {
if (fillArea[x, y]) if (fillArea[x, y])
{ {
map[x, y] -= strength; map[x, y] -= strength;
if (map[x, y] < -100f) if (map[x, y] < 0f)
map[x, y] = -100f; map[x, y] = 0f;
} }
} }
} }

View File

@ -54,8 +54,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes
if (distancefactor > 0.0) if (distancefactor > 0.0)
{ {
double newz = map[x, y] - distancefactor * strength; double newz = map[x, y] - distancefactor * strength;
if (newz <= -100f) if (newz <= 0f)
map[x, y] = -100f; map[x, y] = 0f;
else else
map[x, y] = newz; map[x, y] = newz;
} }

View File

@ -43,14 +43,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes
int x, y; int x, y;
for (x = startX; x <= endX; x++) for (x = startX; x <= endX; ++x)
{ {
for (y = startY; y <= endY; y++) for (y = startY; y <= endY; ++y)
{ {
if (!mask[x, y]) if (!mask[x, y])
continue; continue;
// Calculate a cos-sphere and add it to the heighmap // Calculate a cos-sphere and add it to the heighmap
double r = Math.Sqrt((x - rx) * (x - rx) + (y - ry) * (y - ry)); double r = Math.Sqrt((x - rx) * (x - rx) + (y - ry) * (y - ry));
double distancefactor = Math.Cos(r * size); double distancefactor = Math.Cos(r * size);
if (distancefactor > 0.0) if (distancefactor > 0.0)

View File

@ -60,10 +60,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
ITerrainPaintableEffect effect = new RaiseSphere(); ITerrainPaintableEffect effect = new RaiseSphere();
effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0f, 2, 6.0f, effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0f, 5, 6.0f,
0, midRegion - 1,0, (int)Constants.RegionSize -1); 0, midRegion - 1,0, (int)Constants.RegionSize -1);
Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128).");
Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); Assert.That(map[124, midRegion] > 0.0, "Raise brush should raising value at this point (124,128).");
Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128).");
Assert.That(map[128, midRegion] == 0.0, "Raise brush should not change value at this point (128,128)."); Assert.That(map[128, midRegion] == 0.0, "Raise brush should not change value at this point (128,128).");
// Assert.That(map[0, midRegion] == 0.0, "Raise brush should not change value at this point (0,128)."); // Assert.That(map[0, midRegion] == 0.0, "Raise brush should not change value at this point (0,128).");
@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
} }
effect = new LowerSphere(); effect = new LowerSphere();
effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0f, 2, 6.0f, effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0f, 5, 6.0f,
0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1); 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1);
Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");