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
This commit is contained in:
Rémi Verschelde
2017-03-05 16:44:50 +01:00
parent 45438e9918
commit 5dbf1809c6
1318 changed files with 140051 additions and 166004 deletions

View File

@ -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