summaryrefslogtreecommitdiff
path: root/core/reference.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /core/reference.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
Diffstat (limited to 'core/reference.cpp')
-rw-r--r--core/reference.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/core/reference.cpp b/core/reference.cpp
index 5e8244d2ca..5285888f78 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -30,7 +30,6 @@
#include "script_language.h"
-
bool Reference::init_ref() {
if (refcount.ref()) {
@@ -39,7 +38,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
}
@@ -49,30 +48,27 @@ bool Reference::init_ref() {
return false;
}
-
}
-
void Reference::_bind_methods() {
- ClassDB::bind_method(D_METHOD("init_ref"),&Reference::init_ref);
- ClassDB::bind_method(D_METHOD("reference"),&Reference::reference);
- ClassDB::bind_method(D_METHOD("unreference"),&Reference::unreference);
+ ClassDB::bind_method(D_METHOD("init_ref"), &Reference::init_ref);
+ ClassDB::bind_method(D_METHOD("reference"), &Reference::reference);
+ ClassDB::bind_method(D_METHOD("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();
@@ -81,7 +77,6 @@ bool Reference::unreference(){
}
return die;
-
}
Reference::Reference() {
@@ -90,14 +85,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);
@@ -113,21 +106,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() {
- ClassDB::bind_method(D_METHOD("get_ref:Object"),&WeakRef::get_ref);
+ ClassDB::bind_method(D_METHOD("get_ref:Object"), &WeakRef::get_ref);
}
#if 0