diff options
Diffstat (limited to 'source/Generating')
-rw-r--r-- | source/Generating/ChunkDesc.cpp | 39 | ||||
-rw-r--r-- | source/Generating/ChunkDesc.h | 48 |
2 files changed, 67 insertions, 20 deletions
diff --git a/source/Generating/ChunkDesc.cpp b/source/Generating/ChunkDesc.cpp index 4a1272ffd..bd1abdeaa 100644 --- a/source/Generating/ChunkDesc.cpp +++ b/source/Generating/ChunkDesc.cpp @@ -383,14 +383,19 @@ HEIGHTTYPE cChunkDesc::GetMaxHeight(void) const -void cChunkDesc::FillRelCuboid(const cCuboid & a_RelCuboid, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
+void cChunkDesc::FillRelCuboid(
+ int a_MinX, int a_MaxX,
+ int a_MinY, int a_MaxY,
+ int a_MinZ, int a_MaxZ,
+ BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
+)
{
- int MinX = std::max(a_RelCuboid.p1.x, 0);
- int MinY = std::max(a_RelCuboid.p1.y, 0);
- int MinZ = std::max(a_RelCuboid.p1.z, 0);
- int MaxX = std::min(a_RelCuboid.p2.x, cChunkDef::Width - 1);
- int MaxY = std::min(a_RelCuboid.p2.y, cChunkDef::Height - 1);
- int MaxZ = std::min(a_RelCuboid.p2.z, cChunkDef::Width - 1);
+ int MinX = std::max(a_MinX, 0);
+ int MinY = std::max(a_MinY, 0);
+ int MinZ = std::max(a_MinZ, 0);
+ int MaxX = std::min(a_MaxX, cChunkDef::Width - 1);
+ int MaxY = std::min(a_MaxY, cChunkDef::Height - 1);
+ int MaxZ = std::min(a_MaxZ, cChunkDef::Width - 1);
for (int y = MinY; y <= MaxY; y++)
{
@@ -408,14 +413,20 @@ void cChunkDesc::FillRelCuboid(const cCuboid & a_RelCuboid, BLOCKTYPE a_BlockTyp -void cChunkDesc::ReplaceRelCuboid(const cCuboid & a_RelCuboid, BLOCKTYPE a_SrcType, NIBBLETYPE a_SrcMeta, BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta)
+void cChunkDesc::ReplaceRelCuboid(
+ int a_MinX, int a_MaxX,
+ int a_MinY, int a_MaxY,
+ int a_MinZ, int a_MaxZ,
+ BLOCKTYPE a_SrcType, NIBBLETYPE a_SrcMeta,
+ BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta
+)
{
- int MinX = std::max(a_RelCuboid.p1.x, 0);
- int MinY = std::max(a_RelCuboid.p1.y, 0);
- int MinZ = std::max(a_RelCuboid.p1.z, 0);
- int MaxX = std::min(a_RelCuboid.p2.x, cChunkDef::Width - 1);
- int MaxY = std::min(a_RelCuboid.p2.y, cChunkDef::Height - 1);
- int MaxZ = std::min(a_RelCuboid.p2.z, cChunkDef::Width - 1);
+ int MinX = std::max(a_MinX, 0);
+ int MinY = std::max(a_MinY, 0);
+ int MinZ = std::max(a_MinZ, 0);
+ int MaxX = std::min(a_MaxX, cChunkDef::Width - 1);
+ int MaxY = std::min(a_MaxY, cChunkDef::Height - 1);
+ int MaxZ = std::min(a_MaxZ, cChunkDef::Width - 1);
for (int y = MinY; y <= MaxY; y++)
{
diff --git a/source/Generating/ChunkDesc.h b/source/Generating/ChunkDesc.h index d4b0c4d91..a73a175a3 100644 --- a/source/Generating/ChunkDesc.h +++ b/source/Generating/ChunkDesc.h @@ -9,8 +9,9 @@ #pragma once -#include "../ChunkDef.h" #include "../BlockArea.h" +#include "../ChunkDef.h" +#include "../Cuboid.h" @@ -19,9 +20,6 @@ // fwd: ../BlockArea.h class cBlockArea; -// fwd: ../Cuboid.h -class cCuboid; - @@ -80,11 +78,49 @@ public: HEIGHTTYPE GetMaxHeight(void) const; /// Fills the relative cuboid with specified block; allows cuboid out of range of this chunk - void FillRelCuboid(const cCuboid & a_RelCuboid, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); + void FillRelCuboid( + int a_MinX, int a_MaxX, + int a_MinY, int a_MaxY, + int a_MinZ, int a_MaxZ, + BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta + ); + + /// Fills the relative cuboid with specified block; allows cuboid out of range of this chunk + void FillRelCuboid(const cCuboid & a_RelCuboid, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) + { + FillRelCuboid( + a_RelCuboid.p1.x, a_RelCuboid.p2.x, + a_RelCuboid.p1.y, a_RelCuboid.p2.y, + a_RelCuboid.p1.z, a_RelCuboid.p2.z, + a_BlockType, a_BlockMeta + ); + } /// Replaces the specified src blocks in the cuboid by the dst blocks; allows cuboid out of range of this chunk - void ReplaceRelCuboid(const cCuboid & a_RelCuboid, BLOCKTYPE a_SrcType, NIBBLETYPE a_SrcMeta, BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta); + void ReplaceRelCuboid( + int a_MinX, int a_MaxX, + int a_MinY, int a_MaxY, + int a_MinZ, int a_MaxZ, + BLOCKTYPE a_SrcType, NIBBLETYPE a_SrcMeta, + BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta + ); + /// Replaces the specified src blocks in the cuboid by the dst blocks; allows cuboid out of range of this chunk + void ReplaceRelCuboid( + const cCuboid & a_RelCuboid, + BLOCKTYPE a_SrcType, NIBBLETYPE a_SrcMeta, + BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta + ) + { + ReplaceRelCuboid( + a_RelCuboid.p1.x, a_RelCuboid.p2.x, + a_RelCuboid.p1.y, a_RelCuboid.p2.y, + a_RelCuboid.p1.z, a_RelCuboid.p2.z, + a_SrcType, a_SrcMeta, + a_DstType, a_DstMeta + ); + } + // tolua_end |