From 990db212771e6fe055f0b99f3e8cd551253603a3 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 23 Oct 2023 19:24:53 +0200 Subject: [PATCH] Codestyle. --- core/array.cpp | 6 +----- core/array.h | 14 +++++--------- core/basis.h | 10 +++------- core/color.h | 12 ++++-------- core/core_types.h | 12 ++++++------ core/dictionary.cpp | 4 ---- core/dictionary.h | 10 +++------- core/math_funcs.h | 6 +++--- core/pandemonium.h | 6 +++--- core/pandemonium_global.cpp | 6 +----- core/pandemonium_global.h | 6 +++--- core/pandemonium_profiling.cpp | 3 --- core/pandemonium_profiling.h | 10 +++------- core/plane.cpp | 14 +++++--------- core/plane.h | 12 ++++-------- core/pool_arrays.cpp | 4 ---- core/pool_arrays.h | 10 +++------- core/projection.h | 6 +++--- core/quaternion.cpp | 6 +----- core/quaternion.h | 6 +++--- core/rect2.cpp | 12 ++++-------- core/rect2.h | 12 ++++-------- core/rect2i.cpp | 4 ---- core/ref.h | 20 ++++++++------------ core/rid.cpp | 4 ---- core/string_name.h | 6 +++--- core/tag_db.h | 6 +++--- core/transform.cpp | 6 +----- core/transform.h | 10 +++------- core/transform_2d.h | 10 +++------- core/typedefs.h | 12 ++++++------ core/ustring.h | 8 ++++---- core/variant.h | 6 +++--- core/vector2.cpp | 4 ---- core/vector2.h | 6 +++--- core/vector2i.cpp | 4 ---- core/vector2i.h | 10 +++------- core/vector3.cpp | 4 ---- core/vector3.h | 6 +++--- core/vector3i.cpp | 6 +----- core/vector3i.h | 10 +++------- core/vector4.cpp | 4 ---- core/vector4.h | 10 +++------- core/vector4i.cpp | 4 ---- core/vector4i.h | 6 +++--- 45 files changed, 115 insertions(+), 238 deletions(-) diff --git a/core/array.cpp b/core/array.cpp index 20a9301..f2972c3 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -30,13 +30,11 @@ #include "array.h" #include "pandemonium_global.h" -#include "variant.h" #include "ustring.h" +#include "variant.h" #include - - class Object; Array::Array() { @@ -223,5 +221,3 @@ void Array::shuffle() { Array::~Array() { Pandemonium::api->pandemonium_array_destroy(&_pandemonium_array); } - - diff --git a/core/array.h b/core/array.h index 54888d6..fddb957 100644 --- a/core/array.h +++ b/core/array.h @@ -1,3 +1,8 @@ +#ifndef ARRAY_H +#define ARRAY_H + +#include + /*************************************************************************/ /* array.h */ /*************************************************************************/ @@ -28,13 +33,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef ARRAY_H -#define ARRAY_H - -#include - - - class String; namespace helpers { @@ -186,6 +184,4 @@ public: ~Array(); }; - - #endif // ARRAY_H diff --git a/core/basis.h b/core/basis.h index f101558..35daf45 100644 --- a/core/basis.h +++ b/core/basis.h @@ -1,3 +1,6 @@ +#ifndef BASIS_H +#define BASIS_H + /*************************************************************************/ /* basis.h */ /*************************************************************************/ @@ -28,17 +31,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef BASIS_H -#define BASIS_H - #include #include "defs.h" #include "vector3.h" - - class Quaternion; class Basis { @@ -453,6 +451,4 @@ public: operator Quaternion() const; }; - - #endif // BASIS_H diff --git a/core/color.h b/core/color.h index 6b53d34..abb0405 100644 --- a/core/color.h +++ b/core/color.h @@ -1,3 +1,6 @@ +#ifndef COLOR_H +#define COLOR_H + /*************************************************************************/ /* color.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef COLOR_H -#define COLOR_H - #include #include @@ -38,8 +38,6 @@ #include "defs.h" #include "ustring.h" - - struct Color { private: // static float _parse_col(const String& p_str, int p_ofs); @@ -141,7 +139,7 @@ public: String to_html(bool p_alpha = true) const; - bool operator<(const Color &p_color) const; //used in set keys + bool operator<(const Color &p_color) const; // used in set keys operator String() const; @@ -166,6 +164,4 @@ public: } }; - - #endif // COLOR_H diff --git a/core/core_types.h b/core/core_types.h index 74738ad..b6b1007 100644 --- a/core/core_types.h +++ b/core/core_types.h @@ -1,3 +1,6 @@ +#ifndef CORETYPES_H +#define CORETYPES_H + /*************************************************************************/ /* core_types.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef CORETYPES_H -#define CORETYPES_H - #include "defs.h" #include "aabb.h" @@ -41,15 +41,15 @@ #include "node_path.h" #include "plane.h" #include "pool_arrays.h" +#include "projection.h" #include "quaternion.h" -#include "rid.h" #include "rect2.h" #include "rect2i.h" -#include "ustring.h" +#include "rid.h" #include "string_name.h" #include "transform.h" #include "transform_2d.h" -#include "projection.h" +#include "ustring.h" #include "variant.h" #include "vector2.h" #include "vector2i.h" diff --git a/core/dictionary.cpp b/core/dictionary.cpp index 5561ce5..37c51ce 100644 --- a/core/dictionary.cpp +++ b/core/dictionary.cpp @@ -33,8 +33,6 @@ #include "pandemonium_global.h" #include "variant.h" - - Dictionary::Dictionary() { Pandemonium::api->pandemonium_dictionary_new(&_pandemonium_dictionary); } @@ -106,5 +104,3 @@ Array Dictionary::values() const { Dictionary::~Dictionary() { Pandemonium::api->pandemonium_dictionary_destroy(&_pandemonium_dictionary); } - - diff --git a/core/dictionary.h b/core/dictionary.h index c4b98ce..5133db8 100644 --- a/core/dictionary.h +++ b/core/dictionary.h @@ -1,3 +1,6 @@ +#ifndef DICTIONARY_H +#define DICTIONARY_H + /*************************************************************************/ /* dictionary.h */ /*************************************************************************/ @@ -28,16 +31,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef DICTIONARY_H -#define DICTIONARY_H - #include "array.h" #include "variant.h" #include - - class Variant; class Dictionary { @@ -85,6 +83,4 @@ public: ~Dictionary(); }; - - #endif // DICTIONARY_H diff --git a/core/math_funcs.h b/core/math_funcs.h index b60ed6d..641c434 100644 --- a/core/math_funcs.h +++ b/core/math_funcs.h @@ -1,3 +1,6 @@ +#ifndef PANDEMONIUM_MATH_H +#define PANDEMONIUM_MATH_H + /*************************************************************************/ /* Math.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PANDEMONIUM_MATH_H -#define PANDEMONIUM_MATH_H - #include "defs.h" #include diff --git a/core/pandemonium.h b/core/pandemonium.h index 871e9a1..e96e614 100644 --- a/core/pandemonium.h +++ b/core/pandemonium.h @@ -1,3 +1,6 @@ +#ifndef PANDEMONIUM_H +#define PANDEMONIUM_H + /*************************************************************************/ /* Pandemonium.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PANDEMONIUM_H -#define PANDEMONIUM_H - #include #include diff --git a/core/pandemonium_global.cpp b/core/pandemonium_global.cpp index dbcb77d..46160ff 100644 --- a/core/pandemonium_global.cpp +++ b/core/pandemonium_global.cpp @@ -30,8 +30,8 @@ #include "pandemonium_global.h" -#include "ustring.h" #include "array.h" +#include "ustring.h" #include "wrapped.h" @@ -51,8 +51,6 @@ static GDCALLINGCONV void wrapper_destroy(void *data, void *wrapper) { Pandemonium::api->pandemonium_free(wrapper); } - - void *_RegisterState::nativescript_handle; int _RegisterState::language_index; @@ -203,5 +201,3 @@ void Pandemonium::nativescript_init(void *handle) { void Pandemonium::nativescript_terminate(void *handle) { Pandemonium::nativescript_api->pandemonium_nativescript_unregister_instance_binding_data_functions(_RegisterState::language_index); } - - diff --git a/core/pandemonium_global.h b/core/pandemonium_global.h index b6d0ef0..bd95e37 100644 --- a/core/pandemonium_global.h +++ b/core/pandemonium_global.h @@ -1,3 +1,6 @@ +#ifndef PANDEMONIUM_GLOBAL_H +#define PANDEMONIUM_GLOBAL_H + /*************************************************************************/ /* pandemonium_global.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PANDEMONIUM_GLOBAL_H -#define PANDEMONIUM_GLOBAL_H - #include #include "array.h" diff --git a/core/pandemonium_profiling.cpp b/core/pandemonium_profiling.cpp index 0cd91e6..4a18035 100644 --- a/core/pandemonium_profiling.cpp +++ b/core/pandemonium_profiling.cpp @@ -5,8 +5,6 @@ #include - - FunctionProfiling::FunctionProfiling(const char *p_function, const int p_line) { snprintf(signature, 1024, "::%d::%s", p_line, p_function); ticks = OS::get_singleton()->get_ticks_usec(); @@ -18,4 +16,3 @@ FunctionProfiling::~FunctionProfiling() { Pandemonium::gdnative_profiling_add_data(signature, t); } } - diff --git a/core/pandemonium_profiling.h b/core/pandemonium_profiling.h index 4436856..6e9b72b 100644 --- a/core/pandemonium_profiling.h +++ b/core/pandemonium_profiling.h @@ -1,3 +1,6 @@ +#ifndef PANDEMONIUM_PROFILING_H +#define PANDEMONIUM_PROFILING_H + /*************************************************************************/ /* pandemonium_profiling.h */ /*************************************************************************/ @@ -28,13 +31,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PANDEMONIUM_PROFILING_H -#define PANDEMONIUM_PROFILING_H - #include "defs.h" - - class FunctionProfiling { char signature[1024]; uint64_t ticks; @@ -44,8 +42,6 @@ public: ~FunctionProfiling(); }; - - #ifdef DEBUG_ENABLED #define PANDEMONIUM_PROFILING_FUNCTION FunctionProfiling __function_profiling(__FUNCTION__, __LINE__); #else diff --git a/core/plane.cpp b/core/plane.cpp index 048c7ac..12f867a 100644 --- a/core/plane.cpp +++ b/core/plane.cpp @@ -34,8 +34,6 @@ #include - - void Plane::set_normal(const Vector3 &p_normal) { this->normal = p_normal; } @@ -107,15 +105,15 @@ bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersectio Vector3 segment = p_dir; real_t den = normal.dot(segment); - //printf("den is %i\n",den); + // printf("den is %i\n",den); if (::fabs(den) <= CMP_EPSILON) { return false; } real_t dist = (normal.dot(p_from) - d) / den; - //printf("dist is %i\n",dist); + // printf("dist is %i\n",dist); - if (dist > CMP_EPSILON) { //this is a ray, before the emiting pos (p_from) doesnt exist + if (dist > CMP_EPSILON) { // this is a ray, before the emiting pos (p_from) doesnt exist return false; } @@ -130,13 +128,13 @@ bool Plane::intersects_segment(Vector3 p_begin, Vector3 p_end, Vector3 *p_inters Vector3 segment = p_begin - p_end; real_t den = normal.dot(segment); - //printf("den is %i\n",den); + // printf("den is %i\n",den); if (::fabs(den) <= CMP_EPSILON) { return false; } real_t dist = (normal.dot(p_begin) - d) / den; - //printf("dist is %i\n",dist); + // printf("dist is %i\n",dist); if (dist < -CMP_EPSILON || dist > (1.0 + CMP_EPSILON)) { return false; @@ -200,5 +198,3 @@ bool Plane::operator==(const Plane &p_plane) const { bool Plane::operator!=(const Plane &p_plane) const { return normal != p_plane.normal || d != p_plane.d; } - - diff --git a/core/plane.h b/core/plane.h index 245d421..dbafc99 100644 --- a/core/plane.h +++ b/core/plane.h @@ -1,3 +1,6 @@ +#ifndef PLANE_H +#define PLANE_H + /*************************************************************************/ /* Plane.h */ /*************************************************************************/ @@ -28,15 +31,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PLANE_H -#define PLANE_H - #include "vector3.h" #include - - enum ClockDirection { CLOCKWISE, @@ -50,7 +48,7 @@ public: void set_normal(const Vector3 &p_normal); - inline Vector3 get_normal() const { return normal; } ///Point is coplanar, CMP_EPSILON for precision + inline Vector3 get_normal() const { return normal; } /// Point is coplanar, CMP_EPSILON for precision void normalize(); @@ -93,6 +91,4 @@ public: Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir = CLOCKWISE); }; - - #endif // PLANE_H diff --git a/core/pool_arrays.cpp b/core/pool_arrays.cpp index bb4dfe5..0fb811f 100644 --- a/core/pool_arrays.cpp +++ b/core/pool_arrays.cpp @@ -39,8 +39,6 @@ #include - - PoolByteArray::PoolByteArray() { Pandemonium::api->pandemonium_pool_byte_array_new(&_pandemonium_array); } @@ -644,5 +642,3 @@ int PoolColorArray::size() const { PoolColorArray::~PoolColorArray() { Pandemonium::api->pandemonium_pool_color_array_destroy(&_pandemonium_array); } - - diff --git a/core/pool_arrays.h b/core/pool_arrays.h index f86d59e..b77b0c6 100644 --- a/core/pool_arrays.h +++ b/core/pool_arrays.h @@ -1,3 +1,6 @@ +#ifndef POOLARRAYS_H +#define POOLARRAYS_H + /*************************************************************************/ /* PoolArrays.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef POOLARRAYS_H -#define POOLARRAYS_H - #include "defs.h" #include "color.h" @@ -42,8 +42,6 @@ #include - - class Array; class PoolByteArray { @@ -864,6 +862,4 @@ public: ~PoolColorArray(); }; - - #endif // POOLARRAYS_H diff --git a/core/projection.h b/core/projection.h index 119f0b7..45c2bbd 100644 --- a/core/projection.h +++ b/core/projection.h @@ -1,3 +1,6 @@ +#ifndef PROJECTION_H +#define PROJECTION_H + /*************************************************************************/ /* Projection.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef CAMERA_MATRIX_H -#define CAMERA_MATRIX_H - #include "defs.h" #include "math_funcs.h" #include "plane.h" diff --git a/core/quaternion.cpp b/core/quaternion.cpp index 9f60d6d..7953235 100644 --- a/core/quaternion.cpp +++ b/core/quaternion.cpp @@ -35,8 +35,6 @@ #include - - const Quaternion Quaternion::IDENTITY = Quaternion(); // set_euler_xyz expects a vector containing the Euler angles in the format @@ -192,7 +190,7 @@ Quaternion Quaternion::slerpni(const Quaternion &q, const real_t &t) const { } Quaternion Quaternion::cubic_slerp(const Quaternion &q, const Quaternion &prep, const Quaternion &postq, const real_t &t) const { - //the only way to do slerp :| + // the only way to do slerp :| real_t t2 = (1.0 - t) * t * 2; Quaternion sp = this->slerp(q, t); Quaternion sq = prep.slerpni(postq, t); @@ -348,5 +346,3 @@ bool Quaternion::operator==(const Quaternion &p_quaternion) const { bool Quaternion::operator!=(const Quaternion &p_quaternion) const { return x != p_quaternion.x || y != p_quaternion.y || z != p_quaternion.z || w != p_quaternion.w; } - - diff --git a/core/quaternion.h b/core/quaternion.h index 0c9215f..bbb7a53 100644 --- a/core/quaternion.h +++ b/core/quaternion.h @@ -1,3 +1,6 @@ +#ifndef QUATERNION_H +#define QUATERNION_H + /*************************************************************************/ /* Quaternion.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef QUATERNION_H -#define QUATERNION_H - #include #include "vector3.h" diff --git a/core/rect2.cpp b/core/rect2.cpp index acaf2f2..9961821 100644 --- a/core/rect2.cpp +++ b/core/rect2.cpp @@ -29,14 +29,12 @@ /*************************************************************************/ #include "rect2.h" -#include "ustring.h" #include "transform_2d.h" +#include "ustring.h" #include "vector2.h" #include - - #ifndef MAX #define MAX(a, b) (a > b ? a : b) #endif @@ -106,7 +104,7 @@ Rect2 Rect2::merge(const Rect2 &p_rect) const { ///< return a merged rect new_rect.size.x = MAX(p_rect.position.x + p_rect.size.x, position.x + size.x); new_rect.size.y = MAX(p_rect.position.y + p_rect.size.y, position.y + size.y); - new_rect.size = new_rect.size - new_rect.position; //make relative again + new_rect.size = new_rect.size - new_rect.position; // make relative again return new_rect; } @@ -171,7 +169,7 @@ bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 } bool Rect2::intersects_transformed(const Transform2D &p_xform, const Rect2 &p_rect) const { - //SAT intersection between local and transformed rect2 + // SAT intersection between local and transformed rect2 Vector2 xf_points[4] = { p_xform.xform(p_rect.position), @@ -182,7 +180,7 @@ bool Rect2::intersects_transformed(const Transform2D &p_xform, const Rect2 &p_re real_t low_limit; - //base rect2 first (faster) + // base rect2 first (faster) if (xf_points[0].y > position.y) goto next1; @@ -319,5 +317,3 @@ next4: return true; } - - diff --git a/core/rect2.h b/core/rect2.h index 44b176f..3e68723 100644 --- a/core/rect2.h +++ b/core/rect2.h @@ -1,3 +1,6 @@ +#ifndef RECT2_H +#define RECT2_H + /*************************************************************************/ /* Rect2.h */ /*************************************************************************/ @@ -28,17 +31,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef RECT2_H -#define RECT2_H - #include "vector2.h" #include #include - - class String; typedef Vector2 Size2; @@ -123,7 +121,7 @@ struct Rect2 { return r; } - inline void expand_to(const Vector2 &p_vector) { //in place function for speed + inline void expand_to(const Vector2 &p_vector) { // in place function for speed Vector2 begin = position; Vector2 end = position + size; @@ -155,6 +153,4 @@ struct Rect2 { } }; - - #endif // RECT2_H diff --git a/core/rect2i.cpp b/core/rect2i.cpp index f29e5eb..90860b7 100644 --- a/core/rect2i.cpp +++ b/core/rect2i.cpp @@ -32,10 +32,6 @@ #include "ustring.h" #include "vector2i.h" - - Rect2i::operator String() const { return String(position) + ", " + String(size); } - - diff --git a/core/ref.h b/core/ref.h index 3aea838..a787e35 100644 --- a/core/ref.h +++ b/core/ref.h @@ -1,3 +1,6 @@ +#ifndef REF_H +#define REF_H + /*************************************************************************/ /* Ref.h */ /*************************************************************************/ @@ -28,15 +31,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef REF_H -#define REF_H - #include "pandemonium_global.h" #include "reference.h" #include "variant.h" - - // Replicates Pandemonium's Ref behavior // Rewritten from f5234e70be7dec4930c2d5a0e829ff480d044b1d. template @@ -178,19 +176,19 @@ public: inline bool is_null() const { return reference == nullptr; } void unref() { - //TODO this should be moved to mutexes, since this engine does not really - // do a lot of referencing on references and stuff - // mutexes will avoid more crashes? + // TODO this should be moved to mutexes, since this engine does not really + // do a lot of referencing on references and stuff + // mutexes will avoid more crashes? if (reference && reference->unreference()) { - //memdelete(reference); + // memdelete(reference); reference->free(); } reference = nullptr; } void instance() { - //ref(memnew(T)); + // ref(memnew(T)); ref(T::_new()); } @@ -211,6 +209,4 @@ public: } }; - - #endif diff --git a/core/rid.cpp b/core/rid.cpp index 87194a7..9deebd0 100644 --- a/core/rid.cpp +++ b/core/rid.cpp @@ -34,8 +34,6 @@ #include "pandemonium_global.h" - - RID::RID() { Pandemonium::api->pandemonium_rid_new(&_pandemonium_rid); } @@ -75,5 +73,3 @@ bool RID::operator<=(const RID &p_other) const { bool RID::operator>=(const RID &p_other) const { return !(*this < p_other); } - - diff --git a/core/string_name.h b/core/string_name.h index 4f9c226..68b92eb 100644 --- a/core/string_name.h +++ b/core/string_name.h @@ -1,3 +1,6 @@ +#ifndef STRING_NAME_H +#define STRING_NAME_H + /*************************************************************************/ /* string.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef STRING_NAME_H -#define STRING_NAME_H - #include class String; diff --git a/core/tag_db.h b/core/tag_db.h index bc51099..be4bbc2 100644 --- a/core/tag_db.h +++ b/core/tag_db.h @@ -1,3 +1,6 @@ +#ifndef TAGDB_H +#define TAGDB_H + /*************************************************************************/ /* TagDB.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef TAGDB_H -#define TAGDB_H - #include namespace _TagDB { diff --git a/core/transform.cpp b/core/transform.cpp index 44aa1e7..4272802 100644 --- a/core/transform.cpp +++ b/core/transform.cpp @@ -37,8 +37,6 @@ #include "quaternion.h" - - const Transform Transform::IDENTITY = Transform(); const Transform Transform::FLIP_X = Transform(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0); const Transform Transform::FLIP_Y = Transform(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0); @@ -111,7 +109,7 @@ AABB Transform::xform(const AABB &p_aabb) const { Vector3 y = basis.get_axis(1) * p_aabb.size.y; Vector3 z = basis.get_axis(2) * p_aabb.size.z; Vector3 pos = xform(p_aabb.position); - //could be even further optimized + // could be even further optimized AABB new_aabb; new_aabb.position = pos; new_aabb.expand_to(pos + x); @@ -301,5 +299,3 @@ Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) { basis = p_basis; origin = p_origin; } - - diff --git a/core/transform.h b/core/transform.h index 3ba05a5..bf29c69 100644 --- a/core/transform.h +++ b/core/transform.h @@ -1,3 +1,6 @@ +#ifndef TRANSFORM_H +#define TRANSFORM_H + /*************************************************************************/ /* Transform.h */ /*************************************************************************/ @@ -28,16 +31,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef TRANSFORM_H -#define TRANSFORM_H - #include "basis.h" #include "aabb.h" #include "plane.h" - - class Transform { public: static const Transform IDENTITY; @@ -116,6 +114,4 @@ public: inline Transform() {} }; - - #endif // TRANSFORM_H diff --git a/core/transform_2d.h b/core/transform_2d.h index 6c3636f..d047c63 100644 --- a/core/transform_2d.h +++ b/core/transform_2d.h @@ -1,3 +1,6 @@ +#ifndef TRANSFORM2D_H +#define TRANSFORM2D_H + /*************************************************************************/ /* Transform2D.h */ /*************************************************************************/ @@ -28,13 +31,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef TRANSFORM2D_H -#define TRANSFORM2D_H - #include "vector2.h" - - typedef Vector2 Size2; struct Rect2; @@ -131,6 +129,4 @@ struct Transform2D { } }; - - #endif // TRANSFORM2D_H diff --git a/core/typedefs.h b/core/typedefs.h index 453b6dc..c0b28b8 100644 --- a/core/typedefs.h +++ b/core/typedefs.h @@ -41,7 +41,7 @@ #define _MKSTR(m_x) _STR(m_x) #endif -//should always inline no matter what +// should always inline no matter what #ifndef _ALWAYS_INLINE_ #if defined(__GNUC__) && (__GNUC__ >= 4) @@ -107,7 +107,7 @@ #endif #endif -//custom, gcc-safe offsetof, because gcc complains a lot. +// custom, gcc-safe offsetof, because gcc complains a lot. template T *_nullptr() { T *t = NULL; @@ -179,7 +179,7 @@ inline void __swap_tmpl(T &x, T &y) { y = aux; } -#endif //swap +#endif // swap /* clang-format off */ #define HEX2CHR(m_hex) \ @@ -381,7 +381,7 @@ struct _GlobalLock { // Limit the depth of recursive algorithms when dealing with Array/Dictionary #define MAX_RECURSION 100 -//HAS_TRIVIAL_CONSTRUCTOR +// HAS_TRIVIAL_CONSTRUCTOR #if defined(__llvm__) && _llvm_has_builtin(__is_trivially_constructible) #define HAS_TRIVIAL_CONSTRUCTOR(T) __is_trivially_constructible(T) @@ -391,7 +391,7 @@ struct _GlobalLock { #define HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) #endif -//HAS_TRIVIAL_DESTRUCTOR +// HAS_TRIVIAL_DESTRUCTOR #if defined(__llvm__) && _llvm_has_builtin(__is_trivially_destructible) #define HAS_TRIVIAL_DESTRUCTOR(T) __is_trivially_destructible(T) @@ -401,7 +401,7 @@ struct _GlobalLock { #define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) #endif -//HAS_TRIVIAL_COPY +// HAS_TRIVIAL_COPY #if defined(__llvm__) && _llvm_has_builtin(__is_trivially_copyable) #define HAS_TRIVIAL_COPY(T) __is_trivially_copyable(T) diff --git a/core/ustring.h b/core/ustring.h index c9e9c0b..24ede00 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -1,3 +1,6 @@ +#ifndef STRING_H +#define STRING_H + /*************************************************************************/ /* String.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef STRING_H -#define STRING_H - #include class NodePath; @@ -73,7 +73,7 @@ class String { friend class NodePath; friend class Variant; friend class StringName; - + explicit inline String(pandemonium_string contents) : _pandemonium_string(contents) {} diff --git a/core/variant.h b/core/variant.h index 38c593f..2ac6c37 100644 --- a/core/variant.h +++ b/core/variant.h @@ -1,3 +1,6 @@ +#ifndef VARIANT_H +#define VARIANT_H + /*************************************************************************/ /* Variant.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VARIANT_H -#define VARIANT_H - #include #include "defs.h" diff --git a/core/vector2.cpp b/core/vector2.cpp index 35e114e..fa6cf5b 100644 --- a/core/vector2.cpp +++ b/core/vector2.cpp @@ -34,8 +34,6 @@ #include "ustring.h" - - const Vector2 Vector2::ZERO = Vector2(); const Vector2 Vector2::ONE = Vector2(1, 1); const Vector2 Vector2::INF = Vector2(INFINITY, INFINITY); @@ -96,5 +94,3 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c Vector2::operator String() const { return String::num(x) + ", " + String::num(y); } - - diff --git a/core/vector2.h b/core/vector2.h index ab68bf3..c398cb3 100644 --- a/core/vector2.h +++ b/core/vector2.h @@ -1,3 +1,6 @@ +#ifndef VECTOR2_H +#define VECTOR2_H + /*************************************************************************/ /* Vector2.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VECTOR2_H -#define VECTOR2_H - #include #include "defs.h" diff --git a/core/vector2i.cpp b/core/vector2i.cpp index e3154b7..76957a5 100644 --- a/core/vector2i.cpp +++ b/core/vector2i.cpp @@ -34,10 +34,6 @@ #include "ustring.h" - - Vector2i::operator String() const { return String::num(x) + ", " + String::num(y); } - - diff --git a/core/vector2i.h b/core/vector2i.h index 85accf3..a85e6ed 100644 --- a/core/vector2i.h +++ b/core/vector2i.h @@ -1,3 +1,6 @@ +#ifndef VECTOR2I_H +#define VECTOR2I_H + /*************************************************************************/ /* vector2.h */ /*************************************************************************/ @@ -28,17 +31,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VECTOR2I_H -#define VECTOR2I_H - #include #include "defs.h" #include - - class String; struct Vector2i { @@ -64,6 +62,4 @@ struct Vector2i { operator String() const; }; - - #endif // VECTOR2_H diff --git a/core/vector3.cpp b/core/vector3.cpp index eb42c90..b9d0a9a 100644 --- a/core/vector3.cpp +++ b/core/vector3.cpp @@ -36,8 +36,6 @@ #include "basis.h" - - const Vector3 Vector3::ZERO = Vector3(); const Vector3 Vector3::ONE = Vector3(1, 1, 1); const Vector3 Vector3::INF = Vector3(INFINITY, INFINITY, INFINITY); @@ -117,5 +115,3 @@ void Vector3::snap(real_t p_val) { Vector3::operator String() const { return String::num(x) + ", " + String::num(y) + ", " + String::num(z); } - - diff --git a/core/vector3.h b/core/vector3.h index 34eac26..b11b5de 100644 --- a/core/vector3.h +++ b/core/vector3.h @@ -1,3 +1,6 @@ +#ifndef VECTOR3_H +#define VECTOR3_H + /*************************************************************************/ /* vector3.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VECTOR3_H -#define VECTOR3_H - #include #include "defs.h" diff --git a/core/vector3i.cpp b/core/vector3i.cpp index 2d4435e..60bb178 100644 --- a/core/vector3i.cpp +++ b/core/vector3i.cpp @@ -34,10 +34,6 @@ #include "ustring.h" - - Vector3i::operator String() const { - return String::num(x) + ", " + String::num(y) + ", " + String::num(z) ; + return String::num(x) + ", " + String::num(y) + ", " + String::num(z); } - - diff --git a/core/vector3i.h b/core/vector3i.h index 1144a8a..698fd31 100644 --- a/core/vector3i.h +++ b/core/vector3i.h @@ -1,3 +1,6 @@ +#ifndef VECTOR3I_H +#define VECTOR3I_H + /*************************************************************************/ /* vector2.h */ /*************************************************************************/ @@ -28,17 +31,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VECTOR3I_H -#define VECTOR3I_H - #include #include "defs.h" #include - - class String; struct Vector3i { @@ -67,6 +65,4 @@ struct Vector3i { operator String() const; }; - - #endif // VECTOR2_H diff --git a/core/vector4.cpp b/core/vector4.cpp index 929b8ed..c8cd980 100644 --- a/core/vector4.cpp +++ b/core/vector4.cpp @@ -34,10 +34,6 @@ #include "ustring.h" - - Vector4::operator String() const { return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w); } - - diff --git a/core/vector4.h b/core/vector4.h index edb5def..0139714 100644 --- a/core/vector4.h +++ b/core/vector4.h @@ -1,3 +1,6 @@ +#ifndef VECTOR4_H +#define VECTOR4_H + /*************************************************************************/ /* vector2.h */ /*************************************************************************/ @@ -28,17 +31,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VECTOR4_H -#define VECTOR4_H - #include #include "defs.h" #include - - class String; struct Vector4 { @@ -70,6 +68,4 @@ struct Vector4 { operator String() const; }; - - #endif // VECTOR2_H diff --git a/core/vector4i.cpp b/core/vector4i.cpp index 75c9dc7..1a626d8 100644 --- a/core/vector4i.cpp +++ b/core/vector4i.cpp @@ -34,10 +34,6 @@ #include "ustring.h" - - Vector4i::operator String() const { return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w); } - - diff --git a/core/vector4i.h b/core/vector4i.h index 7531465..df00fc7 100644 --- a/core/vector4i.h +++ b/core/vector4i.h @@ -1,3 +1,6 @@ +#ifndef VECTOR4I_H +#define VECTOR4I_H + /*************************************************************************/ /* vector2.h */ /*************************************************************************/ @@ -28,9 +31,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VECTOR4I_H -#define VECTOR4I_H - #include #include "defs.h"