diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-27 11:59:54 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-27 11:59:54 +0200 |
commit | 50fc1a54699b437aa7f5fccc22f594707d31238d (patch) | |
tree | 9fdd63cb495d30703871f8bfc51737175d0609e2 /src/Generating/FinishGen.cpp | |
parent | Updated NetherFort prefabs to latest Gallery content. (diff) | |
download | cuberite-50fc1a54699b437aa7f5fccc22f594707d31238d.tar cuberite-50fc1a54699b437aa7f5fccc22f594707d31238d.tar.gz cuberite-50fc1a54699b437aa7f5fccc22f594707d31238d.tar.bz2 cuberite-50fc1a54699b437aa7f5fccc22f594707d31238d.tar.lz cuberite-50fc1a54699b437aa7f5fccc22f594707d31238d.tar.xz cuberite-50fc1a54699b437aa7f5fccc22f594707d31238d.tar.zst cuberite-50fc1a54699b437aa7f5fccc22f594707d31238d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Generating/FinishGen.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 4c40270e8..03137f616 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -91,19 +91,50 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a { bool IsFireBlock = a_Block == E_BLOCK_FIRE; - for (int x = a_RelX - 4; x < a_RelX + 4; x++) + int MinX = a_RelX - 4; + if (MinX < 0) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MinX = 0; + } + + int MaxX = a_RelX + 4; + if (MaxX > cChunkDef::Width) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MaxX = cChunkDef::Width; + } + + int MinZ = a_RelZ - 4; + if (MinZ < 0) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MinZ = 0; + } + + int MaxZ = a_RelZ + 4; + if (MaxZ > cChunkDef::Width) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MaxZ = cChunkDef::Width; + } + + int MinY = a_RelY - 2; + if (MinY < 0) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MinY = 0; + } + + int MaxY = a_RelY + 2; + if (MaxY > cChunkDef::Height) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MaxY = cChunkDef::Height; + } + + for (int x = MinX; x < MaxX; x++) { int xx = a_ChunkDesc.GetChunkX() * cChunkDef::Width + x; - for (int z = a_RelZ - 4; z < a_RelZ + 4; z++) + for (int z = MinZ; z < MaxZ; z++) { int zz = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z; - for (int y = a_RelY - 2; y < a_RelY + 2; y++) + for (int y = MinY; y < MaxY; y++) { - if ((y < 1) || (y > cChunkDef::Height)) - { - continue; - } - if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) // Don't replace non air blocks. { continue; |