summaryrefslogtreecommitdiffstats
path: root/src/Noise/InterpolNoise.h
diff options
context:
space:
mode:
authormjagdis <mjagdis@eris-associates.co.uk>2024-11-01 23:17:27 +0100
committerGitHub <noreply@github.com>2024-11-01 23:17:27 +0100
commit2bafab723394a741be0876795ec7c658ee28bcab (patch)
tree1104f475bc5708ced50bbfb15ecab2e1b0ead616 /src/Noise/InterpolNoise.h
parentMake wall banners actually placeable (#5574) (diff)
downloadcuberite-2bafab723394a741be0876795ec7c658ee28bcab.tar
cuberite-2bafab723394a741be0876795ec7c658ee28bcab.tar.gz
cuberite-2bafab723394a741be0876795ec7c658ee28bcab.tar.bz2
cuberite-2bafab723394a741be0876795ec7c658ee28bcab.tar.lz
cuberite-2bafab723394a741be0876795ec7c658ee28bcab.tar.xz
cuberite-2bafab723394a741be0876795ec7c658ee28bcab.tar.zst
cuberite-2bafab723394a741be0876795ec7c658ee28bcab.zip
Diffstat (limited to '')
-rw-r--r--src/Noise/InterpolNoise.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/Noise/InterpolNoise.h b/src/Noise/InterpolNoise.h
index 447796739..12b167dbe 100644
--- a/src/Noise/InterpolNoise.h
+++ b/src/Noise/InterpolNoise.h
@@ -427,28 +427,37 @@ public:
// Calculate query values using Cell:
int FromZ = 0;
- for (int z = 0; z < NumSameZ; z++)
+ for (int z = 0; z < NumSameZ;)
{
int ToZ = FromZ + SameZ[z];
int CurFloorZ = FloorZ[FromZ];
int FromY = 0;
- for (int y = 0; y < NumSameY; y++)
+ for (int y = 0; y < NumSameY;)
{
int ToY = FromY + SameY[y];
int CurFloorY = FloorY[FromY];
int FromX = 0;
- for (int x = 0; x < NumSameX; x++)
+ for (int x = 0; x < NumSameX;)
{
int ToX = FromX + SameX[x];
Cell.Generate(FromX, ToX, FromY, ToY, FromZ, ToZ);
- Cell.Move(FloorX[ToX], CurFloorY, CurFloorZ);
- FromX = ToX;
+ if (++x < NumSameX) // Call Move() every time except for the last loop iteration
+ {
+ Cell.Move(FloorX[ToX], CurFloorY, CurFloorZ);
+ FromX = ToX;
+ }
+ }
+ if (++y < NumSameY) // Call Move() every time except for the last loop iteration
+ {
+ Cell.Move(FloorX[0], FloorY[ToY], CurFloorZ);
+ FromY = ToY;
}
- Cell.Move(FloorX[0], FloorY[ToY], CurFloorZ);
- FromY = ToY;
} // for y
- Cell.Move(FloorX[0], FloorY[0], FloorZ[ToZ]);
- FromZ = ToZ;
+ if (++z < NumSameZ) // Call Move() every time except for the last loop iteration
+ {
+ Cell.Move(FloorX[0], FloorY[0], FloorZ[ToZ]);
+ FromZ = ToZ;
+ }
} // for z
}