diff options
author | madmaxoft <github@xoft.cz> | 2014-06-22 21:30:06 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-06-23 00:15:55 +0200 |
commit | 82dcc0b4db030f2a463a990652e0d75b67bdf835 (patch) | |
tree | 121642efd4824e62fa93ec50a03cb016021eaeee | |
parent | Merge pull request #1105 from Howaner/Blocks (diff) | |
download | cuberite-82dcc0b4db030f2a463a990652e0d75b67bdf835.tar cuberite-82dcc0b4db030f2a463a990652e0d75b67bdf835.tar.gz cuberite-82dcc0b4db030f2a463a990652e0d75b67bdf835.tar.bz2 cuberite-82dcc0b4db030f2a463a990652e0d75b67bdf835.tar.lz cuberite-82dcc0b4db030f2a463a990652e0d75b67bdf835.tar.xz cuberite-82dcc0b4db030f2a463a990652e0d75b67bdf835.tar.zst cuberite-82dcc0b4db030f2a463a990652e0d75b67bdf835.zip |
-rw-r--r-- | src/Generating/Prefab.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Generating/Prefab.cpp b/src/Generating/Prefab.cpp index 2ab1455b9..7d876909a 100644 --- a/src/Generating/Prefab.cpp +++ b/src/Generating/Prefab.cpp @@ -211,6 +211,17 @@ void cPrefab::Draw(cChunkDesc & a_Dest, const Vector3i & a_Placement, int a_NumR int ChunkStartZ = a_Dest.GetChunkZ() * cChunkDef::Width; Placement.Move(-ChunkStartX, 0, -ChunkStartZ); const cBlockArea & Image = m_BlockArea[a_NumRotations]; + + // If the placement is outside this chunk, bail out: + if ( + (Placement.x > cChunkDef::Width) || (Placement.x + Image.GetSizeX() < 0) || + (Placement.z > cChunkDef::Width) || (Placement.z + Image.GetSizeZ() < 0) + ) + { + return; + } + + // Write the image: a_Dest.WriteBlockArea(Image, Placement.x, Placement.y, Placement.z, m_MergeStrategy); // If requested, draw the floor (from the bottom of the prefab down to the nearest non-air) |