aboutsummaryrefslogtreecommitdiff
path: root/scene/3d/proximity_group.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-03-05 16:44:50 +0100
committerRémi Verschelde2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /scene/3d/proximity_group.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
downloadgodot-5dbf180.tar.gz
godot-5dbf180.tar.zst
godot-5dbf180.zip
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 'scene/3d/proximity_group.cpp')
-rw-r--r--scene/3d/proximity_group.cpp45
1 files changed, 20 insertions, 25 deletions
diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp
index f0dc8cb2e..f1225b690 100644
--- a/scene/3d/proximity_group.cpp
+++ b/scene/3d/proximity_group.cpp
@@ -47,7 +47,7 @@ void ProximityGroup::clear_groups() {
E = E->next();
};
- for (int i=0; i<num; i++) {
+ for (int i = 0; i < num; i++) {
groups.erase(remove_list[i]);
};
@@ -74,7 +74,7 @@ void ProximityGroup::update_groups() {
clear_groups();
};
-void ProximityGroup::add_groups(int* p_cell, String p_base, int p_depth) {
+void ProximityGroup::add_groups(int *p_cell, String p_base, int p_depth) {
p_base = p_base + "|";
if (grid_radius[p_depth] == 0) {
@@ -89,7 +89,7 @@ void ProximityGroup::add_groups(int* p_cell, String p_base, int p_depth) {
int start = p_cell[p_depth] - grid_radius[p_depth];
int end = p_cell[p_depth] + grid_radius[p_depth];
- for (int i=start; i<=end; i++) {
+ for (int i = start; i <= end; i++) {
String gname = p_base + itos(i);
if (p_depth == 2) {
@@ -102,7 +102,7 @@ void ProximityGroup::add_groups(int* p_cell, String p_base, int p_depth) {
void ProximityGroup::_new_group(StringName p_name) {
- const Map<StringName, uint32_t>::Element* E = groups.find(p_name);
+ const Map<StringName, uint32_t>::Element *E = groups.find(p_name);
if (!E) {
add_to_group(p_name);
};
@@ -119,13 +119,13 @@ void ProximityGroup::_notification(int what) {
switch (what) {
- case NOTIFICATION_EXIT_TREE:
- ++group_version;
- clear_groups();
- break;
- case NOTIFICATION_TRANSFORM_CHANGED:
- update_groups();
- break;
+ case NOTIFICATION_EXIT_TREE:
+ ++group_version;
+ clear_groups();
+ break;
+ case NOTIFICATION_TRANSFORM_CHANGED:
+ update_groups();
+ break;
};
};
@@ -138,7 +138,6 @@ void ProximityGroup::broadcast(String p_name, Variant p_params) {
get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFAULT, E->key(), "_proximity_group_broadcast", p_name, p_params);
E = E->next();
};
-
};
void ProximityGroup::_proximity_group_broadcast(String p_name, Variant p_params) {
@@ -152,13 +151,12 @@ void ProximityGroup::_proximity_group_broadcast(String p_name, Variant p_params)
};
};
-
void ProximityGroup::set_dispatch_mode(int p_mode) {
dispatch_mode = (DispatchMode)p_mode;
};
-void ProximityGroup::set_grid_radius(const Vector3& p_radius) {
+void ProximityGroup::set_grid_radius(const Vector3 &p_radius) {
grid_radius = p_radius;
};
@@ -168,22 +166,20 @@ Vector3 ProximityGroup::get_grid_radius() const {
return grid_radius;
};
-
void ProximityGroup::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_group_name","name"), &ProximityGroup::set_group_name);
- ClassDB::bind_method(D_METHOD("broadcast","name", "parameters"), &ProximityGroup::broadcast);
- ClassDB::bind_method(D_METHOD("set_dispatch_mode","mode"), &ProximityGroup::set_dispatch_mode);
- ClassDB::bind_method(D_METHOD("_proximity_group_broadcast","name","params"), &ProximityGroup::_proximity_group_broadcast);
- ClassDB::bind_method(D_METHOD("set_grid_radius","radius"), &ProximityGroup::set_grid_radius);
+ ClassDB::bind_method(D_METHOD("set_group_name", "name"), &ProximityGroup::set_group_name);
+ ClassDB::bind_method(D_METHOD("broadcast", "name", "parameters"), &ProximityGroup::broadcast);
+ ClassDB::bind_method(D_METHOD("set_dispatch_mode", "mode"), &ProximityGroup::set_dispatch_mode);
+ ClassDB::bind_method(D_METHOD("_proximity_group_broadcast", "name", "params"), &ProximityGroup::_proximity_group_broadcast);
+ ClassDB::bind_method(D_METHOD("set_grid_radius", "radius"), &ProximityGroup::set_grid_radius);
ClassDB::bind_method(D_METHOD("get_grid_radius"), &ProximityGroup::get_grid_radius);
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3, "grid_radius"), "set_grid_radius", "get_grid_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "grid_radius"), "set_grid_radius", "get_grid_radius");
- ADD_SIGNAL( MethodInfo("broadcast", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::ARRAY, "parameters")) );
+ ADD_SIGNAL(MethodInfo("broadcast", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::ARRAY, "parameters")));
};
-
ProximityGroup::ProximityGroup() {
group_version = 0;
@@ -191,9 +187,8 @@ ProximityGroup::ProximityGroup() {
grid_radius = Vector3(1, 1, 1);
set_notify_transform(true);
-
};
-ProximityGroup::~ProximityGroup() {
+ProximityGroup::~ProximityGroup(){
};