diff options
Diffstat (limited to 'src/Cuboid.h')
-rw-r--r-- | src/Cuboid.h | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/src/Cuboid.h b/src/Cuboid.h index 4fefb8f57..f804c4bcd 100644 --- a/src/Cuboid.h +++ b/src/Cuboid.h @@ -8,17 +8,23 @@ // tolua_begin class cCuboid { -public: + public: // p1 is expected to have the smaller of the coords; Sort() swaps coords to match this Vector3i p1, p2; cCuboid(void) {} - 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) {} + 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 +#ifdef TOLUA_EXPOSITION // tolua isn't aware of implicitly generated copy constructors + cCuboid(const cCuboid & a_Cuboid); +#endif // tolua_end // Exported in ManualBindings.cpp to support the old deprecated coord-based overload. @@ -59,20 +65,12 @@ public: bool IsInside(Vector3i v) const { - return ( - (v.x >= p1.x) && (v.x <= p2.x) && - (v.y >= p1.y) && (v.y <= p2.y) && - (v.z >= p1.z) && (v.z <= p2.z) - ); + return ((v.x >= p1.x) && (v.x <= p2.x) && (v.y >= p1.y) && (v.y <= p2.y) && (v.z >= p1.z) && (v.z <= p2.z)); } bool IsInside(Vector3d v) const { - return ( - (v.x >= p1.x) && (v.x <= p2.x) && - (v.y >= p1.y) && (v.y <= p2.y) && - (v.z >= p1.z) && (v.z <= p2.z) - ); + return ((v.x >= p1.x) && (v.x <= p2.x) && (v.y >= p1.y) && (v.y <= p2.y) && (v.z >= p1.z) && (v.z <= p2.z)); } // tolua_begin @@ -120,28 +118,20 @@ public: // tolua_end /** Checks the two cuboids for equality. */ - bool operator == (const cCuboid & aOther) const + bool operator==(const cCuboid & aOther) const { return ( - (p1.x == aOther.p1.x) && - (p1.y == aOther.p1.y) && - (p1.z == aOther.p1.z) && - (p2.x == aOther.p2.x) && - (p2.y == aOther.p2.y) && - (p2.z == aOther.p2.z) + (p1.x == aOther.p1.x) && (p1.y == aOther.p1.y) && (p1.z == aOther.p1.z) && (p2.x == aOther.p2.x) && + (p2.y == aOther.p2.y) && (p2.z == aOther.p2.z) ); } - bool operator != (const cCuboid & aOther) const - { - return !operator ==(aOther); - } + bool operator!=(const cCuboid & aOther) const { return !operator==(aOther); } // tolua_begin -private: - + private: /** Returns true if the two specified intervals have a non-empty union */ inline static bool DoIntervalsIntersect(int a_Min1, int a_Max1, int a_Min2, int a_Max2) { @@ -149,10 +139,5 @@ private: ASSERT(a_Min2 <= a_Max2); return ((a_Min1 <= a_Max2) && (a_Max1 >= a_Min2)); } - -} ; +}; // tolua_end - - - - |