You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Bring that Whole New World to the Old Continent too
Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6.
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#include "reference.h"
|
||||
#include "script_language.h"
|
||||
|
||||
|
||||
bool Reference::init_ref() {
|
||||
|
||||
if (refcount.ref()) {
|
||||
@@ -38,7 +37,7 @@ bool Reference::init_ref() {
|
||||
// at the same time, which is never likely to happen (would be crazy to do)
|
||||
// so don't do it.
|
||||
|
||||
if (refcount_init.get()>0) {
|
||||
if (refcount_init.get() > 0) {
|
||||
refcount_init.unref();
|
||||
refcount.unref(); // first referencing is already 1, so compensate for the ref above
|
||||
}
|
||||
@@ -48,30 +47,27 @@ bool Reference::init_ref() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Reference::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("init_ref"),&Reference::init_ref);
|
||||
ObjectTypeDB::bind_method(_MD("reference"),&Reference::reference);
|
||||
ObjectTypeDB::bind_method(_MD("unreference"),&Reference::unreference);
|
||||
ObjectTypeDB::bind_method(_MD("init_ref"), &Reference::init_ref);
|
||||
ObjectTypeDB::bind_method(_MD("reference"), &Reference::reference);
|
||||
ObjectTypeDB::bind_method(_MD("unreference"), &Reference::unreference);
|
||||
}
|
||||
|
||||
int Reference::reference_get_count() const {
|
||||
return refcount.get();
|
||||
}
|
||||
|
||||
void Reference::reference(){
|
||||
void Reference::reference() {
|
||||
|
||||
refcount.ref();
|
||||
if (get_script_instance()) {
|
||||
get_script_instance()->refcount_incremented();
|
||||
}
|
||||
|
||||
}
|
||||
bool Reference::unreference(){
|
||||
bool Reference::unreference() {
|
||||
|
||||
bool die = refcount.unref();
|
||||
|
||||
@@ -80,7 +76,6 @@ bool Reference::unreference(){
|
||||
}
|
||||
|
||||
return die;
|
||||
|
||||
}
|
||||
|
||||
Reference::Reference() {
|
||||
@@ -89,14 +84,12 @@ Reference::Reference() {
|
||||
refcount_init.init();
|
||||
}
|
||||
|
||||
|
||||
Reference::~Reference() {
|
||||
|
||||
}
|
||||
|
||||
Variant WeakRef::get_ref() const {
|
||||
|
||||
if (ref==0)
|
||||
if (ref == 0)
|
||||
return Variant();
|
||||
|
||||
Object *obj = ObjectDB::get_instance(ref);
|
||||
@@ -112,21 +105,21 @@ Variant WeakRef::get_ref() const {
|
||||
}
|
||||
|
||||
void WeakRef::set_obj(Object *p_object) {
|
||||
ref=p_object ? p_object->get_instance_ID() : 0;
|
||||
ref = p_object ? p_object->get_instance_ID() : 0;
|
||||
}
|
||||
|
||||
void WeakRef::set_ref(const REF& p_ref) {
|
||||
void WeakRef::set_ref(const REF &p_ref) {
|
||||
|
||||
ref=p_ref.is_valid() ? p_ref->get_instance_ID() : 0;
|
||||
ref = p_ref.is_valid() ? p_ref->get_instance_ID() : 0;
|
||||
}
|
||||
|
||||
WeakRef::WeakRef() {
|
||||
ref=0;
|
||||
ref = 0;
|
||||
}
|
||||
|
||||
void WeakRef::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_ref:Object"),&WeakRef::get_ref);
|
||||
ObjectTypeDB::bind_method(_MD("get_ref:Object"), &WeakRef::get_ref);
|
||||
}
|
||||
#if 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user