summaryrefslogtreecommitdiffstats
path: root/src/Generating
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-18 09:45:32 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-18 09:45:32 +0200
commitb5fa96f4f8c6bba3a22f55f715bc246bf48d3438 (patch)
tree88d78a46457cf338fcf2f3d43383c1a6ba0e580e /src/Generating
parentAdd liberapay link (diff)
downloadcuberite-b5fa96f4f8c6bba3a22f55f715bc246bf48d3438.tar
cuberite-b5fa96f4f8c6bba3a22f55f715bc246bf48d3438.tar.gz
cuberite-b5fa96f4f8c6bba3a22f55f715bc246bf48d3438.tar.bz2
cuberite-b5fa96f4f8c6bba3a22f55f715bc246bf48d3438.tar.lz
cuberite-b5fa96f4f8c6bba3a22f55f715bc246bf48d3438.tar.xz
cuberite-b5fa96f4f8c6bba3a22f55f715bc246bf48d3438.tar.zst
cuberite-b5fa96f4f8c6bba3a22f55f715bc246bf48d3438.zip
Diffstat (limited to 'src/Generating')
-rw-r--r--src/Generating/FinishGen.cpp16
-rw-r--r--src/Generating/FinishGen.h5
2 files changed, 8 insertions, 13 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index aa7dd86c1..c82e5f4d4 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -1062,7 +1062,7 @@ void cFinishGenPreSimulator::GenFinish(cChunkDesc & a_ChunkDesc)
{
if (m_PreSimulateFallingBlocks)
{
- CollapseSandGravel(a_ChunkDesc.GetBlockTypes(), a_ChunkDesc.GetHeightMap());
+ CollapseSandGravel(a_ChunkDesc);
}
if (m_PreSimulateWater)
@@ -1081,10 +1081,7 @@ void cFinishGenPreSimulator::GenFinish(cChunkDesc & a_ChunkDesc)
-void cFinishGenPreSimulator::CollapseSandGravel(
- cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
- cChunkDef::HeightMap & a_HeightMap // Height map to update by the current data
-)
+void cFinishGenPreSimulator::CollapseSandGravel(cChunkDesc & a_ChunkDesc)
{
for (int z = 0; z < cChunkDef::Width; z++)
{
@@ -1094,7 +1091,7 @@ void cFinishGenPreSimulator::CollapseSandGravel(
int HeightY = 0;
for (int y = 0; y < cChunkDef::Height; y++)
{
- BLOCKTYPE Block = cChunkDef::GetBlock(a_BlockTypes, x, y, z);
+ BLOCKTYPE Block = a_ChunkDesc.GetBlockType(x, y, z);
switch (Block)
{
default:
@@ -1124,8 +1121,9 @@ void cFinishGenPreSimulator::CollapseSandGravel(
{
if (LastY < y - 1)
{
- cChunkDef::SetBlock(a_BlockTypes, x, LastY + 1, z, Block);
- cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR);
+ auto BlockMeta = a_ChunkDesc.GetBlockMeta(x, y, z);
+ a_ChunkDesc.SetBlockTypeMeta(x, LastY + 1, z, Block, BlockMeta);
+ a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_AIR, 0);
}
LastY++;
if (LastY > HeightY)
@@ -1136,7 +1134,7 @@ void cFinishGenPreSimulator::CollapseSandGravel(
}
} // switch (GetBlock)
} // for y
- cChunkDef::SetHeight(a_HeightMap, x, z, static_cast<HEIGHTTYPE>(HeightY));
+ a_ChunkDesc.SetHeight(x, z, static_cast<HEIGHTTYPE>(HeightY));
} // for x
} // for z
}
diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h
index 30108b6da..0138c84bc 100644
--- a/src/Generating/FinishGen.h
+++ b/src/Generating/FinishGen.h
@@ -393,10 +393,7 @@ protected:
bool m_PreSimulateLava;
/** Drops hanging sand and gravel down to the ground, recalculates heightmap */
- void CollapseSandGravel(
- cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
- cChunkDef::HeightMap & a_HeightMap // Height map to update by the current data
- );
+ void CollapseSandGravel(cChunkDesc & a_ChunkDesc);
/** For each fluid block:
- if all surroundings are of the same fluid, makes it stationary; otherwise makes it flowing (excl. top)