summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-11-15 21:45:24 +0100
committerMattes D <github@xoft.cz>2014-11-15 21:45:24 +0100
commit564b9ad33711b45c59d3c001df1b9206c7cbf60e (patch)
tree0db87b3ee90c6c9e6cfe544d6f4df0d365b386ce /src
parentSnow generator: Fixed failure at top of the world. (diff)
downloadcuberite-564b9ad33711b45c59d3c001df1b9206c7cbf60e.tar
cuberite-564b9ad33711b45c59d3c001df1b9206c7cbf60e.tar.gz
cuberite-564b9ad33711b45c59d3c001df1b9206c7cbf60e.tar.bz2
cuberite-564b9ad33711b45c59d3c001df1b9206c7cbf60e.tar.lz
cuberite-564b9ad33711b45c59d3c001df1b9206c7cbf60e.tar.xz
cuberite-564b9ad33711b45c59d3c001df1b9206c7cbf60e.tar.zst
cuberite-564b9ad33711b45c59d3c001df1b9206c7cbf60e.zip
Diffstat (limited to 'src')
-rw-r--r--src/Generating/StructGen.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp
index ca8f0411f..2f685c808 100644
--- a/src/Generating/StructGen.cpp
+++ b/src/Generating/StructGen.cpp
@@ -100,7 +100,7 @@ void cStructGenTrees::GenerateSingleTree(
int Height = a_ChunkDesc.GetHeight(x, z);
- if ((Height <= 0) || (Height > 240))
+ if ((Height <= 0) || (Height >= 230))
{
return;
}
@@ -128,6 +128,11 @@ void cStructGenTrees::GenerateSingleTree(
// Outside the chunk
continue;
}
+ if (itr->y >= cChunkDef::Height)
+ {
+ // Above the chunk, cut off (this shouldn't happen too often, we're limiting trees to y < 230)
+ continue;
+ }
BLOCKTYPE Block = a_ChunkDesc.GetBlockType(itr->x, itr->y, itr->z);
switch (Block)
@@ -162,7 +167,7 @@ void cStructGenTrees::ApplyTreeImage(
// Put the generated image into a_BlockTypes, push things outside this chunk into a_Blocks
for (sSetBlockVector::const_iterator itr = a_Image.begin(), end = a_Image.end(); itr != end; ++itr)
{
- if ((itr->ChunkX == a_ChunkX) && (itr->ChunkZ == a_ChunkZ))
+ if ((itr->ChunkX == a_ChunkX) && (itr->ChunkZ == a_ChunkZ) && (itr->y < cChunkDef::Height))
{
// Inside this chunk, integrate into a_ChunkDesc:
switch (a_ChunkDesc.GetBlockType(itr->x, itr->y, itr->z))