From e7016b15259f8432e0a333a948498fb280d4d7a9 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 9 Aug 2019 03:13:15 +0200 Subject: Removed coord-based API from cCuboid. (#4362) --- src/Cuboid.h | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/Cuboid.h') diff --git a/src/Cuboid.h b/src/Cuboid.h index acb19d46b..864bea7a2 100644 --- a/src/Cuboid.h +++ b/src/Cuboid.h @@ -13,22 +13,21 @@ public: Vector3i p1, p2; cCuboid(void) {} - cCuboid(const Vector3i & a_p1, const Vector3i & a_p2) : p1(a_p1), p2(a_p2) {} + cCuboid(Vector3i a_p1, Vector3i a_p2) : p1(a_p1), p2(a_p2) {} cCuboid(int a_X1, int a_Y1, int a_Z1) : p1(a_X1, a_Y1, a_Z1), p2(a_X1, a_Y1, a_Z1) {} #ifdef TOLUA_EXPOSITION // tolua isn't aware of implicitly generated copy constructors cCuboid(const cCuboid & a_Cuboid); #endif - // DEPRECATED, use cCuboid(Vector3i, Vector3i) instead - cCuboid(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2) : p1(a_X1, a_Y1, a_Z1), p2(a_X2, a_Y2, a_Z2) - { - LOGWARNING("cCuboid(int, int, int, int, int, int) constructor is deprecated, use cCuboid(Vector3i, Vector3i) constructor instead."); - } + // tolua_end + // Exported in ManualBindings.cpp to support the old deprecated coord-based overload. - void Assign(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2); + void Assign(Vector3i a_Point1, Vector3i a_Point2); void Assign(const cCuboid & a_SrcCuboid) { *this = a_SrcCuboid; } + // tolua_begin + void Sort(void); int DifX(void) const { return p2.x - p1.x; } @@ -55,6 +54,9 @@ public: ); } + // tolua_end + // Exported in ManualBindings.cpp to support the old deprecated coord-based overload. + bool IsInside(Vector3i v) const { return ( @@ -64,15 +66,6 @@ public: ); } - bool IsInside(int a_X, int a_Y, int a_Z) const - { - return ( - (a_X >= p1.x) && (a_X <= p2.x) && - (a_Y >= p1.y) && (a_Y <= p2.y) && - (a_Z >= p1.z) && (a_Z <= p2.z) - ); - } - bool IsInside(Vector3d v) const { return ( @@ -82,12 +75,19 @@ public: ); } - /** Returns true if this cuboid is completely inside the specifie cuboid (in all 6 coords). + // tolua_begin + + /** Returns true if this cuboid is completely inside the specified cuboid (in all 6 coords). Assumes both cuboids are sorted. */ bool IsCompletelyInside(const cCuboid & a_Outer) const; - /** Moves the cuboid by the specified offsets in each direction */ - void Move(int a_OfsX, int a_OfsY, int a_OfsZ); + // tolua_end + + /** Moves the cuboid by the specified offset. + Exported in ManualBindings to support the old deprecated coord-based overload. */ + void Move(Vector3i a_Offset); + + // tolua_begin /** Expands the cuboid by the specified amount in each direction. Works on unsorted cuboids as well. @@ -109,6 +109,7 @@ public: /** If needed, expands the cuboid so that it contains the specified point. Assumes sorted. Doesn't contract. */ void Engulf(Vector3i a_Point); + private: /** Returns true if the two specified intervals have a non-empty union */ -- cgit v1.2.3