From 1565d9b3ce8e74cdf8d2c95181f98531794f2c36 Mon Sep 17 00:00:00 2001 From: mBornand <63592189+mBornand@users.noreply.github.com> Date: Fri, 8 May 2020 11:04:07 +0200 Subject: Use Vector3 for cLineBlockTracer and cBlockTracer (#4715) * cLineBlockTracer uses Vector --- src/LineBlockTracer.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/LineBlockTracer.h') diff --git a/src/LineBlockTracer.h b/src/LineBlockTracer.h index 0dca6dfcb..b1dacee20 100644 --- a/src/LineBlockTracer.h +++ b/src/LineBlockTracer.h @@ -45,15 +45,13 @@ public: cLineBlockTracer(cWorld & a_World, cCallbacks & a_Callbacks); /** Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits()) */ - bool Trace(double a_StartX, double a_StartY, double a_StartZ, double a_EndX, double a_EndY, double a_EndZ); + bool Trace(Vector3d a_Start, Vector3d a_End); - // Utility functions for simple one-line usage: - /** Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits()) */ - static bool Trace(cWorld & a_World, cCallbacks & a_Callbacks, double a_StartX, double a_StartY, double a_StartZ, double a_EndX, double a_EndY, double a_EndZ); + // Utility functions for simple one-line usage: /** Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits()) */ - static bool Trace(cWorld & a_World, cCallbacks & a_Callbacks, const Vector3d & a_Start, const Vector3d & a_End); + static bool Trace(cWorld & a_World, cCallbacks & a_Callbacks, const Vector3d a_Start, const Vector3d a_End); /** Returns true if the two positions are within line of sight (not obscured by blocks). a_Sight specifies which blocks are considered transparent for the trace, is an OR-combination of eLineOfSight constants. */ @@ -75,19 +73,19 @@ public: protected: /** The start point of the trace */ - double m_StartX, m_StartY, m_StartZ; + Vector3d m_Start; /** The end point of the trace */ - double m_EndX, m_EndY, m_EndZ; + Vector3d m_End; /** The difference in coords, End - Start */ - double m_DiffX, m_DiffY, m_DiffZ; + Vector3d m_Diff; /** The increment at which the block coords are going from Start to End; either +1 or -1 */ - int m_DirX, m_DirY, m_DirZ; + Vector3i m_Dir; /** The current block */ - int m_CurrentX, m_CurrentY, m_CurrentZ; + Vector3i m_Current; /** The face through which the current block has been entered */ eBlockFace m_CurrentFace; @@ -110,5 +108,3 @@ protected: - - -- cgit v1.2.3