From 5261e316c52b214dd4602397f4a620e5cee0d132 Mon Sep 17 00:00:00 2001 From: x12xx12x <44411062+12xx12@users.noreply.github.com> Date: Wed, 20 Apr 2022 08:21:41 +0200 Subject: handled the infinite loop and style --- src/ClientHandle.cpp | 4 ++-- src/Mobs/PathFinder.cpp | 2 +- src/Simulator/FluidSimulator.cpp | 14 ++++++++------ src/World.cpp | 22 ++++++++++++---------- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 15118dd2d..db54cc77b 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2683,13 +2683,13 @@ void cClientHandle::SendExplosion(const Vector3f a_Position, const float a_Power auto ParticleCount = std::min(static_cast(ParticleFormula * 125), 600); // Dark smoke particles: - SendParticleEffect("largesmoke", a_Position, {0.f, 0.f, 0.f,}, Spread, static_cast(ParticleCount)); + SendParticleEffect("largesmoke", a_Position, {0.f, 0.f, 0.f}, Spread, static_cast(ParticleCount)); Spread = ParticleFormula * 0.35f; ParticleCount = std::min(static_cast(ParticleFormula * 550), 1800); // Light smoke particles: - SendParticleEffect("explode", a_Position, {0.f, 0.f, 0.f,}, Spread, static_cast(ParticleCount)); + SendParticleEffect("explode", a_Position, {0.f, 0.f, 0.f}, Spread, static_cast(ParticleCount)); // Shockwave effect: m_Protocol->SendExplosion(a_Position, a_Power); diff --git a/src/Mobs/PathFinder.cpp b/src/Mobs/PathFinder.cpp index 260044f3b..2e832918a 100644 --- a/src/Mobs/PathFinder.cpp +++ b/src/Mobs/PathFinder.cpp @@ -236,7 +236,7 @@ bool cPathFinder::EnsureProperPoint(Vector3d & a_Vector, cChunk & a_Chunk) // Go down to the lowest air block. if (InTheAir) { - while (cChunkDef::IsValidHeight(a_Vector.addedY(-1))) + while (cChunkDef::IsValidHeight(BelowRel.addedY(-1))) { Chunk->GetBlockTypeMeta(BelowRel.addedY(-1), BlockType, BlockMeta); if (IsWaterOrSolid(BlockType)) diff --git a/src/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp index 968b8bd6e..3771b0804 100644 --- a/src/Simulator/FluidSimulator.cpp +++ b/src/Simulator/FluidSimulator.cpp @@ -153,13 +153,15 @@ Vector3f cFluidSimulator::GetFlowingDirection(Vector3i a_Pos) NIBBLETYPE LevelPoint[4]; // blocks around the checking pos - std::array Offsets { + std::array Offsets { - { 1, 0, 0 }, - { 0, 0, 1 }, - { 1, 0, 0 }, - { 0, 0, 1 } - }}; + { + { 1, 0, 0 }, + { 0, 0, 1 }, + { 1, 0, 0 }, + { 0, 0, 1 } + } + }; for (size_t i = 0; i < Offsets.size(); i++) { diff --git a/src/World.cpp b/src/World.cpp index 77230e5b8..65908ed9d 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -860,16 +860,18 @@ bool cWorld::CheckPlayerSpawnPoint(Vector3i a_Pos) // Check that surrounding blocks are neither solid or liquid constexpr std::array SurroundingCoords = - {{ - {0, 0, 1}, - {1, 0, 1}, - {1, 0, 0}, - {1, 0, -1}, - {0, 0, -1}, - {-1, 0, -1}, - {-1, 0, 0}, - {-1, 0, 1}, - }}; + { + { + {0, 0, 1}, + {1, 0, 1}, + {1, 0, 0}, + {1, 0, -1}, + {0, 0, -1}, + {-1, 0, -1}, + {-1, 0, 0}, + {-1, 0, 1}, + } + }; for (const auto & Offset : SurroundingCoords) { -- cgit v1.2.3