From 284f54ed81186d3122b994db7395e870703efb4f Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 10 Jul 2022 23:56:25 +0100 Subject: Explosions: improve performance --- src/Items/ItemBucket.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/Items/ItemBucket.h') diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index e7fa0fe38..4403342f8 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -6,7 +6,7 @@ #include "../World.h" #include "../Simulator/FluidSimulator.h" #include "../Blocks/BlockHandler.h" -#include "../LineBlockTracer.h" +#include "../Physics/Tracers/LineBlockTracer.h" #include "../Blocks/ChunkInterface.h" @@ -185,7 +185,7 @@ public: bool GetBlockFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos) const { class cCallbacks : - public cBlockTracer::cCallbacks + public BlockTracerCallbacks { public: Vector3i m_Pos; @@ -213,11 +213,10 @@ public: } } Callbacks; - cLineBlockTracer Tracer(*a_World, Callbacks); Vector3d Start(a_Player->GetEyePosition() + a_Player->GetLookVector()); Vector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5); - Tracer.Trace(Start, End); + LineBlockTracer::Trace(*a_World, Callbacks, Start, End); if (!Callbacks.m_HasHitFluid) { @@ -236,7 +235,7 @@ public: bool GetPlacementCoordsFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta, eBlockFace & a_BlockFace) const { class cCallbacks : - public cBlockTracer::cCallbacks + public BlockTracerCallbacks { public: Vector3i m_Pos; @@ -262,14 +261,13 @@ public: } } Callbacks; - cLineBlockTracer Tracer(*a_World, Callbacks); Vector3d Start(a_Player->GetEyePosition()); Vector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5); - // cLineBlockTracer::Trace() returns true when whole line was traversed. By returning true from the callback when we hit something, + // LineBlockTracer::Trace() returns true when whole line was traversed. By returning true from the callback when we hit something, // we ensure that this never happens if liquid could be placed // Use this to judge whether the position is valid - if (!Tracer.Trace(Start, End)) + if (!LineBlockTracer::Trace(*a_World, Callbacks, Start, End)) { a_BlockPos = Callbacks.m_Pos; a_BlockType = Callbacks.m_ReplacedBlockType; -- cgit v1.2.3