summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-05 22:28:54 +0200
committermadmaxoft <github@xoft.cz>2014-05-05 22:28:54 +0200
commite4af9a21af44a7c5d4e02ac17a1b694858c8a39d (patch)
tree0ae417a8c813cfb133efcb01f404b60a3a84f545
parentFixed a flipped condition in cBlockArea::Merge(). (diff)
downloadcuberite-e4af9a21af44a7c5d4e02ac17a1b694858c8a39d.tar
cuberite-e4af9a21af44a7c5d4e02ac17a1b694858c8a39d.tar.gz
cuberite-e4af9a21af44a7c5d4e02ac17a1b694858c8a39d.tar.bz2
cuberite-e4af9a21af44a7c5d4e02ac17a1b694858c8a39d.tar.lz
cuberite-e4af9a21af44a7c5d4e02ac17a1b694858c8a39d.tar.xz
cuberite-e4af9a21af44a7c5d4e02ac17a1b694858c8a39d.tar.zst
cuberite-e4af9a21af44a7c5d4e02ac17a1b694858c8a39d.zip
-rw-r--r--src/Generating/Prefab.cpp63
1 files changed, 33 insertions, 30 deletions
diff --git a/src/Generating/Prefab.cpp b/src/Generating/Prefab.cpp
index 44d5097de..0f20603be 100644
--- a/src/Generating/Prefab.cpp
+++ b/src/Generating/Prefab.cpp
@@ -174,44 +174,47 @@ void cPrefab::Draw(cChunkDesc & a_Dest, const cPlacedPiece * a_Placement) const
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)
- int MaxX = Image.GetSizeX();
- int MaxZ = Image.GetSizeZ();
- for (int z = 0; z < MaxZ; z++)
+ if (m_ShouldExtendFloor)
{
- int RelZ = Placement.z + z;
- if ((RelZ < 0) || (RelZ >= cChunkDef::Width))
+ int MaxX = Image.GetSizeX();
+ int MaxZ = Image.GetSizeZ();
+ for (int z = 0; z < MaxZ; z++)
{
- // Z coord outside the chunk
- continue;
- }
- for (int x = 0; x < MaxX; x++)
- {
- int RelX = Placement.x + x;
- if ((RelX < 0) || (RelX >= cChunkDef::Width))
- {
- // X coord outside the chunk
- continue;
- }
- BLOCKTYPE BlockType;
- NIBBLETYPE BlockMeta;
- Image.GetRelBlockTypeMeta(x, 0, z, BlockType, BlockMeta);
- if ((BlockType == E_BLOCK_AIR) || (BlockType == E_BLOCK_SPONGE))
+ int RelZ = Placement.z + z;
+ if ((RelZ < 0) || (RelZ >= cChunkDef::Width))
{
- // Do not expand air nor sponge blocks
+ // Z coord outside the chunk
continue;
}
- for (int y = Placement.y - 1; y >= 0; y--)
+ for (int x = 0; x < MaxX; x++)
{
- BLOCKTYPE ExistingBlock = a_Dest.GetBlockType(RelX, y, RelZ);
- if (ExistingBlock != E_BLOCK_AIR)
+ int RelX = Placement.x + x;
+ if ((RelX < 0) || (RelX >= cChunkDef::Width))
+ {
+ // X coord outside the chunk
+ continue;
+ }
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ Image.GetRelBlockTypeMeta(x, 0, z, BlockType, BlockMeta);
+ if ((BlockType == E_BLOCK_AIR) || (BlockType == E_BLOCK_SPONGE))
{
- // End the expansion for this column, reached the end
- break;
+ // Do not expand air nor sponge blocks
+ continue;
}
- a_Dest.SetBlockTypeMeta(RelX, y, RelZ, BlockType, BlockMeta);
- } // for y
- } // for x
- } // for z
+ for (int y = Placement.y - 1; y >= 0; y--)
+ {
+ BLOCKTYPE ExistingBlock = a_Dest.GetBlockType(RelX, y, RelZ);
+ if (ExistingBlock != E_BLOCK_AIR)
+ {
+ // End the expansion for this column, reached the end
+ break;
+ }
+ a_Dest.SetBlockTypeMeta(RelX, y, RelZ, BlockType, BlockMeta);
+ } // for y
+ } // for x
+ } // for z
+ }
}