diff options
| author | George Marques <george@gmarqu.es> | 2021-02-28 16:52:06 -0300 |
|---|---|---|
| committer | George Marques <george@gmarqu.es> | 2021-02-28 16:57:34 -0300 |
| commit | cba90d630177ce6c57b5537e74ef3eab4e9c1ea2 (patch) | |
| tree | 439897c2673d4f0af2635abffe73699d0cae6a01 /include/core | |
| parent | 77d41fa179e40560f1e264ed483638bf51713779 (diff) | |
| download | redot-cpp-cba90d630177ce6c57b5537e74ef3eab4e9c1ea2.tar.gz | |
Update clang-format to version 11
This is taken from the Godot repository, so formatting is similar. This
updates the style rules as well.
Also fix style in files to conform with this version.
Diffstat (limited to 'include/core')
| -rw-r--r-- | include/core/AABB.hpp | 2 | ||||
| -rw-r--r-- | include/core/CameraMatrix.hpp | 2 | ||||
| -rw-r--r-- | include/core/Color.hpp | 2 | ||||
| -rw-r--r-- | include/core/Godot.hpp | 4 | ||||
| -rw-r--r-- | include/core/GodotGlobal.hpp | 1 | ||||
| -rw-r--r-- | include/core/Math.hpp | 1 | ||||
| -rw-r--r-- | include/core/PoolArrays.hpp | 1 | ||||
| -rw-r--r-- | include/core/Rect2.hpp | 5 | ||||
| -rw-r--r-- | include/core/Ref.hpp | 18 | ||||
| -rw-r--r-- | include/core/String.hpp | 1 | ||||
| -rw-r--r-- | include/core/Vector3.hpp | 2 |
11 files changed, 0 insertions, 39 deletions
diff --git a/include/core/AABB.hpp b/include/core/AABB.hpp index 41ade0a..bed3f35 100644 --- a/include/core/AABB.hpp +++ b/include/core/AABB.hpp @@ -16,12 +16,10 @@ public: real_t get_area() const; /// get area inline bool has_no_area() const { - return (size.x <= CMP_EPSILON || size.y <= CMP_EPSILON || size.z <= CMP_EPSILON); } inline bool has_no_surface() const { - return (size.x <= CMP_EPSILON && size.y <= CMP_EPSILON && size.z <= CMP_EPSILON); } diff --git a/include/core/CameraMatrix.hpp b/include/core/CameraMatrix.hpp index c90bc51..b17210e 100644 --- a/include/core/CameraMatrix.hpp +++ b/include/core/CameraMatrix.hpp @@ -14,7 +14,6 @@ using namespace godot; } // namespace struct CameraMatrix { - enum Planes { PLANE_NEAR, PLANE_FAR, @@ -84,7 +83,6 @@ struct CameraMatrix { }; Vector3 CameraMatrix::xform(const Vector3 &p_vec3) const { - Vector3 ret; ret.x = matrix[0][0] * p_vec3.x + matrix[1][0] * p_vec3.y + matrix[2][0] * p_vec3.z + matrix[3][0]; ret.y = matrix[0][1] * p_vec3.x + matrix[1][1] * p_vec3.y + matrix[2][1] * p_vec3.z + matrix[3][1]; diff --git a/include/core/Color.hpp b/include/core/Color.hpp index e4116f2..87cf430 100644 --- a/include/core/Color.hpp +++ b/include/core/Color.hpp @@ -11,12 +11,10 @@ namespace godot { struct Color { - private: // static float _parse_col(const String& p_str, int p_ofs); public: union { - struct { float r; float g; diff --git a/include/core/Godot.hpp b/include/core/Godot.hpp index d98535f..bf52d7b 100644 --- a/include/core/Godot.hpp +++ b/include/core/Godot.hpp @@ -321,7 +321,6 @@ void register_method(const char *name, M method_ptr, godot_method_rpc_mode rpc_t template <class D, class B, class R, class... As> void register_method_explicit(const char *name, R (B::*method_ptr)(As...), godot_method_rpc_mode rpc_type = GODOT_METHOD_RPC_MODE_DISABLED) { - static_assert(std::is_base_of<B, D>::value, "Explicit class must derive from method class"); register_method(name, static_cast<R (D::*)(As...)>(method_ptr), rpc_type); } @@ -394,7 +393,6 @@ void register_property(const char *name, P(T::*var), P default_value, godot_method_rpc_mode rpc_mode = GODOT_METHOD_RPC_MODE_DISABLED, godot_property_usage_flags usage = GODOT_PROPERTY_USAGE_DEFAULT, godot_property_hint hint = GODOT_PROPERTY_HINT_NONE, String hint_string = "") { - static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes"); Variant def_val = default_value; @@ -451,7 +449,6 @@ void register_property(const char *name, void (T::*setter)(P), P (T::*getter)(), godot_method_rpc_mode rpc_mode = GODOT_METHOD_RPC_MODE_DISABLED, godot_property_usage_flags usage = GODOT_PROPERTY_USAGE_DEFAULT, godot_property_hint hint = GODOT_PROPERTY_HINT_NONE, String hint_string = "") { - static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes"); Variant def_val = default_value; @@ -495,7 +492,6 @@ void register_property(const char *name, void (T::*setter)(P), P (T::*getter)() godot_method_rpc_mode rpc_mode = GODOT_METHOD_RPC_MODE_DISABLED, godot_property_usage_flags usage = GODOT_PROPERTY_USAGE_DEFAULT, godot_property_hint hint = GODOT_PROPERTY_HINT_NONE, String hint_string = "") { - register_property(name, setter, (P(T::*)())getter, default_value, rpc_mode, usage, hint, hint_string); } diff --git a/include/core/GodotGlobal.hpp b/include/core/GodotGlobal.hpp index 70f7157..780356e 100644 --- a/include/core/GodotGlobal.hpp +++ b/include/core/GodotGlobal.hpp @@ -23,7 +23,6 @@ extern "C" const godot_gdnative_ext_net_3_2_api_struct *net_3_2_api; extern "C" const void *gdnlib; class Godot { - public: static void print(const String &message); static void print_warning(const String &description, const String &function, const String &file, int line); diff --git a/include/core/Math.hpp b/include/core/Math.hpp index a971bb8..4cabe0d 100644 --- a/include/core/Math.hpp +++ b/include/core/Math.hpp @@ -232,7 +232,6 @@ inline double stepify(double p_value, double p_step) { }
inline unsigned int next_power_of_2(unsigned int x) {
-
if (x == 0)
return 0;
diff --git a/include/core/PoolArrays.hpp b/include/core/PoolArrays.hpp index 9421e83..f7720b1 100644 --- a/include/core/PoolArrays.hpp +++ b/include/core/PoolArrays.hpp @@ -26,7 +26,6 @@ class PoolByteArray { public: class Read { - friend class PoolByteArray; godot_pool_byte_array_read_access *_read_access; diff --git a/include/core/Rect2.hpp b/include/core/Rect2.hpp index 2843960..d9c1bc6 100644 --- a/include/core/Rect2.hpp +++ b/include/core/Rect2.hpp @@ -17,7 +17,6 @@ typedef Vector2 Point2; struct Transform2D; struct Rect2 { - Point2 position; Size2 size; @@ -48,14 +47,12 @@ struct Rect2 { bool intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_position = nullptr, Point2 *r_normal = nullptr) const; inline bool encloses(const Rect2 &p_rect) const { - return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) && ((p_rect.position.x + p_rect.size.x) < (position.x + size.x)) && ((p_rect.position.y + p_rect.size.y) < (position.y + size.y)); } inline bool has_no_area() const { - return (size.x <= 0 || size.y <= 0); } Rect2 clip(const Rect2 &p_rect) const; @@ -82,7 +79,6 @@ struct Rect2 { inline bool operator!=(const Rect2 &p_rect) const { return position != p_rect.position || size != p_rect.size; } inline Rect2 grow(real_t p_by) const { - Rect2 g = *this; g.position.x -= p_by; g.position.y -= p_by; @@ -92,7 +88,6 @@ struct Rect2 { } inline Rect2 expand(const Vector2 &p_vector) const { - Rect2 r = *this; r.expand_to(p_vector); return r; diff --git a/include/core/Ref.hpp b/include/core/Ref.hpp index 80133a1..79bb1a8 100644 --- a/include/core/Ref.hpp +++ b/include/core/Ref.hpp @@ -19,7 +19,6 @@ class Ref { T *reference = nullptr; void ref(const Ref &p_from) { - if (p_from.reference == reference) return; @@ -31,7 +30,6 @@ class Ref { } void ref_pointer(T *p_ref) { - ERR_FAIL_COND(p_ref == nullptr); if (p_ref->init_ref()) @@ -40,44 +38,35 @@ class Ref { public: inline bool operator<(const Ref<T> &p_r) const { - return reference < p_r.reference; } inline bool operator==(const Ref<T> &p_r) const { - return reference == p_r.reference; } inline bool operator!=(const Ref<T> &p_r) const { - return reference != p_r.reference; } inline T *operator->() { - return reference; } inline T *operator*() { - return reference; } inline const T *operator->() const { - return reference; } inline const T *ptr() const { - return reference; } inline T *ptr() { - return reference; } inline const T *operator*() const { - return reference; } @@ -88,7 +77,6 @@ public: } void operator=(const Ref &p_from) { - ref(p_from); } @@ -118,7 +106,6 @@ public: } Ref(const Ref &p_from) { - reference = nullptr; ref(p_from); } @@ -138,7 +125,6 @@ public: } Ref(T *p_reference) { - if (p_reference) ref_pointer(p_reference); else @@ -146,7 +132,6 @@ public: } Ref(const Variant &p_variant) { - reference = nullptr; Object *refb = T::___get_from_variant(p_variant); if (refb == nullptr) { @@ -168,7 +153,6 @@ public: // mutexes will avoid more crashes? if (reference && reference->unreference()) { - //memdelete(reference); reference->free(); } @@ -181,12 +165,10 @@ public: } Ref() { - reference = nullptr; } ~Ref() { - unref(); } diff --git a/include/core/String.hpp b/include/core/String.hpp index 57e7eb7..7c11ac7 100644 --- a/include/core/String.hpp +++ b/include/core/String.hpp @@ -14,7 +14,6 @@ class PoolStringArray; class String; class CharString { - friend class String; godot_char_string _char_string; diff --git a/include/core/Vector3.hpp b/include/core/Vector3.hpp index cbd4f75..5fddff5 100644 --- a/include/core/Vector3.hpp +++ b/include/core/Vector3.hpp @@ -14,7 +14,6 @@ namespace godot { class Basis; struct Vector3 { - enum Axis { AXIS_X, AXIS_Y, @@ -305,7 +304,6 @@ inline Vector3 operator*(real_t p_scalar, const Vector3 &p_vec) { } inline Vector3 vec3_cross(const Vector3 &p_a, const Vector3 &p_b) { - return p_a.cross(p_b); } |
