You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 17:36:07 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
#include "broad_phase_2d_basic.h"
|
||||
|
||||
BroadPhase2DBasic::ID BroadPhase2DBasic::create(CollisionObject2DSW *p_object_, int p_subindex) {
|
||||
|
||||
current++;
|
||||
|
||||
Element e;
|
||||
@@ -44,52 +43,43 @@ BroadPhase2DBasic::ID BroadPhase2DBasic::create(CollisionObject2DSW *p_object_,
|
||||
}
|
||||
|
||||
void BroadPhase2DBasic::move(ID p_id, const Rect2 &p_aabb) {
|
||||
|
||||
Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND(!E);
|
||||
E->get().aabb = p_aabb;
|
||||
}
|
||||
void BroadPhase2DBasic::set_static(ID p_id, bool p_static) {
|
||||
|
||||
Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND(!E);
|
||||
E->get()._static = p_static;
|
||||
}
|
||||
void BroadPhase2DBasic::remove(ID p_id) {
|
||||
|
||||
Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND(!E);
|
||||
element_map.erase(E);
|
||||
}
|
||||
|
||||
CollisionObject2DSW *BroadPhase2DBasic::get_object(ID p_id) const {
|
||||
|
||||
const Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND_V(!E, nullptr);
|
||||
return E->get().owner;
|
||||
}
|
||||
bool BroadPhase2DBasic::is_static(ID p_id) const {
|
||||
|
||||
const Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND_V(!E, false);
|
||||
return E->get()._static;
|
||||
}
|
||||
int BroadPhase2DBasic::get_subindex(ID p_id) const {
|
||||
|
||||
const Map<ID, Element>::Element *E = element_map.find(p_id);
|
||||
ERR_FAIL_COND_V(!E, -1);
|
||||
return E->get().subindex;
|
||||
}
|
||||
|
||||
int BroadPhase2DBasic::cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices) {
|
||||
|
||||
int rc = 0;
|
||||
|
||||
for (Map<ID, Element>::Element *E = element_map.front(); E; E = E->next()) {
|
||||
|
||||
const Rect2 aabb = E->get().aabb;
|
||||
if (aabb.intersects_segment(p_from, p_to)) {
|
||||
|
||||
p_results[rc] = E->get().owner;
|
||||
p_result_indices[rc] = E->get().subindex;
|
||||
rc++;
|
||||
@@ -101,14 +91,11 @@ int BroadPhase2DBasic::cull_segment(const Vector2 &p_from, const Vector2 &p_to,
|
||||
return rc;
|
||||
}
|
||||
int BroadPhase2DBasic::cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices) {
|
||||
|
||||
int rc = 0;
|
||||
|
||||
for (Map<ID, Element>::Element *E = element_map.front(); E; E = E->next()) {
|
||||
|
||||
const Rect2 aabb = E->get().aabb;
|
||||
if (aabb.intersects(p_aabb)) {
|
||||
|
||||
p_results[rc] = E->get().owner;
|
||||
p_result_indices[rc] = E->get().subindex;
|
||||
rc++;
|
||||
@@ -121,23 +108,18 @@ int BroadPhase2DBasic::cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_re
|
||||
}
|
||||
|
||||
void BroadPhase2DBasic::set_pair_callback(PairCallback p_pair_callback, void *p_userdata) {
|
||||
|
||||
pair_userdata = p_userdata;
|
||||
pair_callback = p_pair_callback;
|
||||
}
|
||||
void BroadPhase2DBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) {
|
||||
|
||||
unpair_userdata = p_userdata;
|
||||
unpair_callback = p_unpair_callback;
|
||||
}
|
||||
|
||||
void BroadPhase2DBasic::update() {
|
||||
|
||||
// recompute pairs
|
||||
for (Map<ID, Element>::Element *I = element_map.front(); I; I = I->next()) {
|
||||
|
||||
for (Map<ID, Element>::Element *J = I->next(); J; J = J->next()) {
|
||||
|
||||
Element *elem_A = &I->get();
|
||||
Element *elem_B = &J->get();
|
||||
|
||||
@@ -157,7 +139,6 @@ void BroadPhase2DBasic::update() {
|
||||
}
|
||||
|
||||
if (pair_ok && !E) {
|
||||
|
||||
void *data = nullptr;
|
||||
if (pair_callback)
|
||||
data = pair_callback(elem_A->owner, elem_A->subindex, elem_B->owner, elem_B->subindex, unpair_userdata);
|
||||
@@ -168,12 +149,10 @@ void BroadPhase2DBasic::update() {
|
||||
}
|
||||
|
||||
BroadPhase2DSW *BroadPhase2DBasic::_create() {
|
||||
|
||||
return memnew(BroadPhase2DBasic);
|
||||
}
|
||||
|
||||
BroadPhase2DBasic::BroadPhase2DBasic() {
|
||||
|
||||
current = 1;
|
||||
unpair_callback = nullptr;
|
||||
unpair_userdata = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user