summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockConcretePowder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockConcretePowder.h')
-rw-r--r--src/Blocks/BlockConcretePowder.h82
1 files changed, 49 insertions, 33 deletions
diff --git a/src/Blocks/BlockConcretePowder.h b/src/Blocks/BlockConcretePowder.h
index 52591b3c1..facd115dd 100644
--- a/src/Blocks/BlockConcretePowder.h
+++ b/src/Blocks/BlockConcretePowder.h
@@ -7,43 +7,59 @@
-class cBlockConcretePowderHandler final :
- public cBlockHandler
+class cBlockConcretePowderHandler final : public cBlockHandler
{
using Super = cBlockHandler;
-public:
-
+ public:
using Super::Super;
-private:
-
+ private:
virtual void OnPlaced(
- cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface,
+ cChunkInterface & a_ChunkInterface,
+ cWorldInterface & a_WorldInterface,
Vector3i a_BlockPos,
- BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta
) const override
{
OnNeighborChanged(a_ChunkInterface, a_BlockPos, BLOCK_FACE_NONE);
}
- virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor) const override
+ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor)
+ const override
{
- a_ChunkInterface.DoWithChunkAt(a_BlockPos, [&](cChunk & a_Chunk) { CheckSoaked(cChunkDef::AbsoluteToRelative(a_BlockPos), a_Chunk); return true; });
+ a_ChunkInterface.DoWithChunkAt(
+ a_BlockPos,
+ [&](cChunk & a_Chunk)
+ {
+ CheckSoaked(cChunkDef::AbsoluteToRelative(a_BlockPos), a_Chunk);
+ return true;
+ }
+ );
}
/** Check blocks above and around to see if they are water. If one is, converts this into concrete block. */
static void CheckSoaked(Vector3i a_Rel, cChunk & a_Chunk)
{
const auto & WaterCheck = cSimulator::AdjacentOffsets;
- const bool ShouldSoak = std::any_of(WaterCheck.cbegin(), WaterCheck.cend(), [a_Rel, & a_Chunk](Vector3i a_Offset)
- {
- BLOCKTYPE NeighborType;
- return (
- a_Chunk.UnboundedRelGetBlockType(a_Rel.x + a_Offset.x, a_Rel.y + a_Offset.y, a_Rel.z + a_Offset.z, NeighborType)
- && IsBlockWater(NeighborType)
- );
- });
+ const bool ShouldSoak = std::any_of(
+ WaterCheck.cbegin(),
+ WaterCheck.cend(),
+ [a_Rel, &a_Chunk](Vector3i a_Offset)
+ {
+ BLOCKTYPE NeighborType;
+ return (
+ a_Chunk.UnboundedRelGetBlockType(
+ a_Rel.x + a_Offset.x,
+ a_Rel.y + a_Offset.y,
+ a_Rel.z + a_Offset.z,
+ NeighborType
+ ) &&
+ IsBlockWater(NeighborType)
+ );
+ }
+ );
if (ShouldSoak)
{
@@ -57,22 +73,22 @@ private:
{
switch (a_Meta)
{
- case E_META_CONCRETE_POWDER_WHITE: return 8;
- case E_META_CONCRETE_POWDER_ORANGE: return 15;
- case E_META_CONCRETE_POWDER_MAGENTA: return 16;
- case E_META_CONCRETE_POWDER_LIGHTBLUE: return 17;
- case E_META_CONCRETE_POWDER_YELLOW: return 18;
+ case E_META_CONCRETE_POWDER_WHITE: return 8;
+ case E_META_CONCRETE_POWDER_ORANGE: return 15;
+ case E_META_CONCRETE_POWDER_MAGENTA: return 16;
+ case E_META_CONCRETE_POWDER_LIGHTBLUE: return 17;
+ case E_META_CONCRETE_POWDER_YELLOW: return 18;
case E_META_CONCRETE_POWDER_LIGHTGREEN: return 19;
- case E_META_CONCRETE_POWDER_PINK: return 20;
- case E_META_CONCRETE_POWDER_GRAY: return 21;
- case E_META_CONCRETE_POWDER_LIGHTGRAY: return 22;
- case E_META_CONCRETE_POWDER_CYAN: return 23;
- case E_META_CONCRETE_POWDER_PURPLE: return 24;
- case E_META_CONCRETE_POWDER_BLUE: return 25;
- case E_META_CONCRETE_POWDER_BROWN: return 26;
- case E_META_CONCRETE_POWDER_GREEN: return 27;
- case E_META_CONCRETE_POWDER_RED: return 28;
- case E_META_CONCRETE_POWDER_BLACK: return 29;
+ case E_META_CONCRETE_POWDER_PINK: return 20;
+ case E_META_CONCRETE_POWDER_GRAY: return 21;
+ case E_META_CONCRETE_POWDER_LIGHTGRAY: return 22;
+ case E_META_CONCRETE_POWDER_CYAN: return 23;
+ case E_META_CONCRETE_POWDER_PURPLE: return 24;
+ case E_META_CONCRETE_POWDER_BLUE: return 25;
+ case E_META_CONCRETE_POWDER_BROWN: return 26;
+ case E_META_CONCRETE_POWDER_GREEN: return 27;
+ case E_META_CONCRETE_POWDER_RED: return 28;
+ case E_META_CONCRETE_POWDER_BLACK: return 29;
default:
{
ASSERT(!"Unhandled meta in concrete powder handler!");