summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-02-16 13:56:32 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-02-16 14:06:29 +0100
commitb8b45804485f7ca18f035f1eeb7a1ac0cf591cac (patch)
treec0fb75bd8d45125f436ccf0b64fcbae464b11ad9 /core
parentf5b9cbaff6f0a058d08187b3124948ae68848cd0 (diff)
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added later on if needed and ported.
Diffstat (limited to 'core')
-rw-r--r--core/core_bind.cpp2
-rw-r--r--core/input/input.cpp1
-rw-r--r--core/io/marshalls.cpp13
-rw-r--r--core/io/resource_format_binary.cpp5
-rw-r--r--core/io/resource_loader.cpp24
-rw-r--r--core/math/bvh_cull.inc3
-rw-r--r--core/math/bvh_debug.inc6
-rw-r--r--core/math/octree.h10
-rw-r--r--core/object/object.cpp13
-rw-r--r--core/object/object.h45
-rw-r--r--core/os/os.cpp6
-rw-r--r--core/os/spin_lock.h2
-rw-r--r--core/variant/type_info.h3
13 files changed, 37 insertions, 96 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 810284d5d0..bb4b49d9cd 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -2291,8 +2291,8 @@ void Engine::register_singleton(const StringName &p_name, Object *p_object) {
s.ptr = p_object;
s.user_created = true;
::Engine::get_singleton()->add_singleton(s);
- ;
}
+
void Engine::unregister_singleton(const StringName &p_name) {
ERR_FAIL_COND_MSG(!has_singleton(p_name), "Attempt to remove unregistered singleton: " + String(p_name));
ERR_FAIL_COND_MSG(!::Engine::get_singleton()->is_singleton_user_created(p_name), "Attempt to remove non-user created singleton: " + String(p_name));
diff --git a/core/input/input.cpp b/core/input/input.cpp
index d36d0f4da0..656bb92203 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -1145,7 +1145,6 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, J
// It doesn't make sense for a full axis to map to a button,
// but keeping as a default for a trigger with a positive half-axis.
event.value = (shifted_positive_value * 2) - 1;
- ;
break;
}
return event;
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 5c39b2fa1b..12de2f582e 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -1417,19 +1417,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
d.get_key_list(&keys);
for (const Variant &E : keys) {
- /*
- CharString utf8 = E->->utf8();
-
- if (buf) {
- encode_uint32(utf8.length()+1,buf);
- buf+=4;
- memcpy(buf,utf8.get_data(),utf8.length()+1);
- }
-
- r_len+=4+utf8.length()+1;
- while (r_len%4)
- r_len++; //pad
- */
int len;
Error err = encode_variant(E, buf, len, p_full_objects, p_depth + 1);
ERR_FAIL_COND_V(err, err);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index ed58b4be7b..611f371229 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1607,11 +1607,6 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
d.get_key_list(&keys);
for (const Variant &E : keys) {
- /*
- if (!_check_type(dict[E]))
- continue;
- */
-
write_variant(f, E, resource_map, external_resources, string_map);
write_variant(f, d[E], resource_map, external_resources, string_map);
}
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 21bf566b1b..2419c76dd3 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -672,10 +672,6 @@ int ResourceLoader::get_import_order(const String &p_path) {
if (!loader[i]->recognize_path(local_path)) {
continue;
}
- /*
- if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
- continue;
- */
return loader[i]->get_import_order(p_path);
}
@@ -690,10 +686,6 @@ String ResourceLoader::get_import_group_file(const String &p_path) {
if (!loader[i]->recognize_path(local_path)) {
continue;
}
- /*
- if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
- continue;
- */
return loader[i]->get_import_group_file(p_path);
}
@@ -708,10 +700,6 @@ bool ResourceLoader::is_import_valid(const String &p_path) {
if (!loader[i]->recognize_path(local_path)) {
continue;
}
- /*
- if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
- continue;
- */
return loader[i]->is_import_valid(p_path);
}
@@ -726,10 +714,6 @@ bool ResourceLoader::is_imported(const String &p_path) {
if (!loader[i]->recognize_path(local_path)) {
continue;
}
- /*
- if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
- continue;
- */
return loader[i]->is_imported(p_path);
}
@@ -744,10 +728,6 @@ void ResourceLoader::get_dependencies(const String &p_path, List<String> *p_depe
if (!loader[i]->recognize_path(local_path)) {
continue;
}
- /*
- if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
- continue;
- */
loader[i]->get_dependencies(local_path, p_dependencies, p_add_types);
}
@@ -760,10 +740,6 @@ Error ResourceLoader::rename_dependencies(const String &p_path, const Map<String
if (!loader[i]->recognize_path(local_path)) {
continue;
}
- /*
- if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
- continue;
- */
return loader[i]->rename_dependencies(local_path, p_map);
}
diff --git a/core/math/bvh_cull.inc b/core/math/bvh_cull.inc
index d7edc8a884..ab468bfd29 100644
--- a/core/math/bvh_cull.inc
+++ b/core/math/bvh_cull.inc
@@ -508,8 +508,9 @@ bool _cull_convex_iterative(uint32_t p_node_id, CullParams &r_params, bool p_ful
uint32_t child_id = leaf.get_item_ref_id(n);
// full up with results? exit early, no point in further testing
- if (!_cull_hit(child_id, r_params))
+ if (!_cull_hit(child_id, r_params)) {
return false;
+ }
}
}
#endif // BVH_CONVEX_CULL_OPTIMIZED
diff --git a/core/math/bvh_debug.inc b/core/math/bvh_debug.inc
index 55db794ee3..896c36ecf1 100644
--- a/core/math/bvh_debug.inc
+++ b/core/math/bvh_debug.inc
@@ -1,8 +1,9 @@
public:
#ifdef BVH_VERBOSE
void _debug_recursive_print_tree(int p_tree_id) const {
- if (_root_node_id[p_tree_id] != BVHCommon::INVALID)
+ if (_root_node_id[p_tree_id] != BVHCommon::INVALID) {
_debug_recursive_print_tree_node(_root_node_id[p_tree_id]);
+ }
}
String _debug_aabb_to_string(const BVHABB_CLASS &aabb) const {
@@ -42,8 +43,9 @@ void _debug_recursive_print_tree_node(uint32_t p_node_id, int depth = 0) const {
sz += "[";
for (int n = 0; n < leaf.num_items; n++) {
- if (n)
+ if (n) {
sz += ", ";
+ }
sz += "r";
sz += itos(leaf.get_item_ref_id(n));
}
diff --git a/core/math/octree.h b/core/math/octree.h
index 23ba4c1aa3..e73f8213b3 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -211,11 +211,6 @@ private:
E = pair_map.insert(key, pdata);
E->get().eA = p_A->pair_list.push_back(&E->get());
E->get().eB = p_B->pair_list.push_back(&E->get());
-
- /*
- if (pair_callback)
- pair_callback(pair_callback_userdata,p_A->userdata,p_B->userdata);
- */
} else {
E->get().refcount++;
}
@@ -854,11 +849,6 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) {
Octant *o = F->get().octant;
typename List<typename Element::OctantOwner, AL>::Element *N = F->next();
- /*
- if (!use_pairs)
- o->elements.erase( F->get().E );
- */
-
if (use_pairs && e.pairable) {
o->pairable_elements.erase(F->get().E);
} else {
diff --git a/core/object/object.cpp b/core/object/object.cpp
index f966607e03..a8a49bd22e 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -402,13 +402,9 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
#endif
}
- //try built-in setgetter
+ // Try built-in setter.
{
if (ClassDB::set_property(this, p_name, p_value, r_valid)) {
- /*
- if (r_valid)
- *r_valid=true;
- */
return;
}
}
@@ -421,7 +417,6 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
return;
} else if (p_name == CoreStringNames::get_singleton()->_meta) {
- //set_meta(p_name,p_value);
metadata = p_value.duplicate();
if (r_valid) {
*r_valid = true;
@@ -429,7 +424,7 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
return;
}
- //something inside the object... :|
+ // Something inside the object... :|
bool success = _setv(p_name, p_value);
if (success) {
if (r_valid) {
@@ -485,7 +480,7 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const {
#endif
}
- //try built-in setgetter
+ // Try built-in getter.
{
if (ClassDB::get_property(const_cast<Object *>(this), p_name, ret)) {
if (r_valid) {
@@ -510,7 +505,7 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const {
return ret;
} else {
- //something inside the object... :|
+ // Something inside the object... :|
bool success = _getv(p_name, ret);
if (success) {
if (r_valid) {
diff --git a/core/object/object.h b/core/object/object.h
index be360703bc..b5be1cf0e7 100644
--- a/core/object/object.h
+++ b/core/object/object.h
@@ -245,13 +245,7 @@ struct MethodInfo {
MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5);
};
-// old cast_to
-//if ( is_type(T::get_class_static()) )
-//return static_cast<T*>(this);
-////else
-//return nullptr;
-
-// API used to extend in GDNative and other C compatible compiled languages
+// API used to extend in GDNative and other C compatible compiled languages.
class MethodBind;
struct ObjectNativeExtension {
@@ -297,8 +291,10 @@ struct ObjectNativeExtension {
#define GDVIRTUAL_IS_OVERRIDDEN_PTR(m_obj, m_name) m_obj->_gdvirtual_##m_name##_overridden()
/*
- the following is an incomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
-*/
+ * The following is an incomprehensible blob of hacks and workarounds to
+ * compensate for many of the fallacies in C++. As a plus, this macro pretty
+ * much alone defines the object model.
+ */
#define REVERSE_GET_PROPERTY_LIST \
public: \
@@ -534,7 +530,7 @@ private:
Set<String> editor_section_folding;
#endif
ScriptInstance *script_instance = nullptr;
- Variant script; //reference does not yet exist, store it in a
+ Variant script; // Reference does not exist yet, store it in a Variant.
Dictionary metadata;
mutable StringName _class_name;
mutable const StringName *_class_ptr = nullptr;
@@ -583,6 +579,7 @@ protected:
}
return can_die;
}
+
friend class NativeExtensionMethodBind;
_ALWAYS_INLINE_ const ObjectNativeExtension *_get_extension() const { return _extension; }
_ALWAYS_INLINE_ GDExtensionClassInstancePtr _get_extension_instance() const { return _extension_instance; }
@@ -617,9 +614,6 @@ protected:
static void get_valid_parents_static(List<String> *p_parents);
static void _get_valid_parents_static(List<String> *p_parents);
- //Variant _call_bind(const StringName& p_name, const Variant& p_arg1 = Variant(), const Variant& p_arg2 = Variant(), const Variant& p_arg3 = Variant(), const Variant& p_arg4 = Variant());
- //void _call_deferred_bind(const StringName& p_name, const Variant& p_arg1 = Variant(), const Variant& p_arg2 = Variant(), const Variant& p_arg3 = Variant(), const Variant& p_arg4 = Variant());
-
Variant _call_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
Variant _call_deferred_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
@@ -641,7 +635,7 @@ protected:
void _disconnect(const StringName &p_signal, const Callable &p_callable, bool p_force = false);
-public: //should be protected, but bug in clang++
+public: // Should be protected, but bug in clang++.
static void initialize_class();
_FORCE_INLINE_ static void register_custom_data_to_otdb() {}
@@ -729,8 +723,6 @@ public:
}
/* IAPI */
- //void set(const String& p_name, const Variant& p_value);
- //Variant get(const String& p_name) const;
void set(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr);
Variant get(const StringName &p_name, bool *r_valid = nullptr) const;
@@ -748,7 +740,7 @@ public:
void notification(int p_notification, bool p_reversed = false);
virtual String to_string();
- //used mainly by script, get and set all INCLUDING string
+ // Used mainly by script, get and set all INCLUDING string.
virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const;
virtual void setvar(const Variant &p_key, const Variant &p_value, bool *r_valid = nullptr);
@@ -757,8 +749,6 @@ public:
void set_script(const Variant &p_script);
Variant get_script() const;
- /* SCRIPT */
-
bool has_meta(const StringName &p_name) const;
void set_meta(const StringName &p_name, const Variant &p_value);
void remove_meta(const StringName &p_name);
@@ -768,13 +758,15 @@ public:
#ifdef TOOLS_ENABLED
void set_edited(bool p_edited);
bool is_edited() const;
- uint32_t get_edited_version() const; //this function is used to check when something changed beyond a point, it's used mainly for generating previews
+ // This function is used to check when something changed beyond a point, it's used mainly for generating previews.
+ uint32_t get_edited_version() const;
#endif
void set_script_instance(ScriptInstance *p_instance);
_FORCE_INLINE_ ScriptInstance *get_script_instance() const { return script_instance; }
- void set_script_and_instance(const Variant &p_script, ScriptInstance *p_instance); //some script languages can't control instance creation, so this function eases the process
+ // Some script languages can't control instance creation, so this function eases the process.
+ void set_script_and_instance(const Variant &p_script, ScriptInstance *p_instance);
void add_user_signal(const MethodInfo &p_signal);
Error emit_signal(const StringName &p_name, VARIANT_ARG_LIST);
@@ -803,10 +795,11 @@ public:
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
- String tr(const StringName &p_message, const StringName &p_context = "") const; // translate message (internationalization)
+ // Translate message (internationalization).
+ String tr(const StringName &p_message, const StringName &p_context = "") const;
String tr_n(const StringName &p_message, const StringName &p_message_plural, int p_n, const StringName &p_context = "") const;
- bool _is_queued_for_deletion = false; // set to true by SceneTree::queue_delete()
+ bool _is_queued_for_deletion = false; // Set to true by SceneTree::queue_delete().
bool is_queued_for_deletion() const;
_FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate = p_enable; }
@@ -838,14 +831,14 @@ bool predelete_handler(Object *p_object);
void postinitialize_handler(Object *p_object);
class ObjectDB {
-//this needs to add up to 63, 1 bit is for reference
+// This needs to add up to 63, 1 bit is for reference.
#define OBJECTDB_VALIDATOR_BITS 39
#define OBJECTDB_VALIDATOR_MASK ((uint64_t(1) << OBJECTDB_VALIDATOR_BITS) - 1)
#define OBJECTDB_SLOT_MAX_COUNT_BITS 24
#define OBJECTDB_SLOT_MAX_COUNT_MASK ((uint64_t(1) << OBJECTDB_SLOT_MAX_COUNT_BITS) - 1)
#define OBJECTDB_REFERENCE_BIT (uint64_t(1) << (OBJECTDB_SLOT_MAX_COUNT_BITS + OBJECTDB_VALIDATOR_BITS))
- struct ObjectSlot { //128 bits per slot
+ struct ObjectSlot { // 128 bits per slot.
uint64_t validator : OBJECTDB_VALIDATOR_BITS;
uint64_t next_free : OBJECTDB_SLOT_MAX_COUNT_BITS;
uint64_t is_ref_counted : 1;
@@ -875,7 +868,7 @@ public:
uint64_t id = p_instance_id;
uint32_t slot = id & OBJECTDB_SLOT_MAX_COUNT_MASK;
- ERR_FAIL_COND_V(slot >= slot_max, nullptr); //this should never happen unless RID is corrupted
+ ERR_FAIL_COND_V(slot >= slot_max, nullptr); // This should never happen unless RID is corrupted.
spin_lock.lock();
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 9558a6978e..9837b6e0aa 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -391,16 +391,18 @@ bool OS::has_feature(const String &p_feature) {
return true;
}
#else
- if (p_feature == "release")
+ if (p_feature == "release") {
return true;
+ }
#endif
#ifdef TOOLS_ENABLED
if (p_feature == "editor") {
return true;
}
#else
- if (p_feature == "standalone")
+ if (p_feature == "standalone") {
return true;
+ }
#endif
if (sizeof(void *) == 8 && p_feature == "64") {
diff --git a/core/os/spin_lock.h b/core/os/spin_lock.h
index 27d915e0ae..6e8d7f46d5 100644
--- a/core/os/spin_lock.h
+++ b/core/os/spin_lock.h
@@ -41,7 +41,7 @@ class SpinLock {
public:
_ALWAYS_INLINE_ void lock() {
while (locked.test_and_set(std::memory_order_acquire)) {
- ;
+ // Continue.
}
}
_ALWAYS_INLINE_ void unlock() {
diff --git a/core/variant/type_info.h b/core/variant/type_info.h
index 5ae35c92d3..ee050cff4f 100644
--- a/core/variant/type_info.h
+++ b/core/variant/type_info.h
@@ -245,8 +245,9 @@ namespace godot {
namespace details {
inline String enum_qualified_name_to_class_info_name(const String &p_qualified_name) {
Vector<String> parts = p_qualified_name.split("::", false);
- if (parts.size() <= 2)
+ if (parts.size() <= 2) {
return String(".").join(parts);
+ }
// Contains namespace. We only want the class and enum names.
return parts[parts.size() - 2] + "." + parts[parts.size() - 1];
}