summaryrefslogtreecommitdiff
path: root/servers/physics_2d
diff options
context:
space:
mode:
authorlupoDharkael <izhe@hotmail.es>2020-04-02 01:20:12 +0200
committerlupoDharkael <izhe@hotmail.es>2020-04-02 13:38:00 +0200
commit95a1400a2ac9de1a29fa305f45b928ce8e3044bd (patch)
treebe0cd59e5a90926e9d653fed9f3b1b77e735ca2f /servers/physics_2d
parent5f11e1557156617366d2c316a97716172103980d (diff)
Replace NULL with nullptr
Diffstat (limited to 'servers/physics_2d')
-rw-r--r--servers/physics_2d/area_pair_2d_sw.cpp4
-rw-r--r--servers/physics_2d/body_2d_sw.cpp14
-rw-r--r--servers/physics_2d/body_2d_sw.h2
-rw-r--r--servers/physics_2d/broad_phase_2d_basic.cpp12
-rw-r--r--servers/physics_2d/broad_phase_2d_basic.h4
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.cpp4
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.h6
-rw-r--r--servers/physics_2d/broad_phase_2d_sw.cpp2
-rw-r--r--servers/physics_2d/broad_phase_2d_sw.h4
-rw-r--r--servers/physics_2d/collision_object_2d_sw.cpp2
-rw-r--r--servers/physics_2d/collision_solver_2d_sat.cpp162
-rw-r--r--servers/physics_2d/collision_solver_2d_sat.h2
-rw-r--r--servers/physics_2d/collision_solver_2d_sw.h6
-rw-r--r--servers/physics_2d/constraint_2d_sw.h2
-rw-r--r--servers/physics_2d/joints_2d_sw.h4
-rw-r--r--servers/physics_2d/physics_server_2d_sw.cpp30
-rw-r--r--servers/physics_2d/physics_server_2d_sw.h2
-rw-r--r--servers/physics_2d/physics_server_2d_wrap_mt.cpp4
-rw-r--r--servers/physics_2d/physics_server_2d_wrap_mt.h6
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp4
-rw-r--r--servers/physics_2d/space_2d_sw.cpp34
-rw-r--r--servers/physics_2d/step_2d_sw.cpp14
22 files changed, 162 insertions, 162 deletions
diff --git a/servers/physics_2d/area_pair_2d_sw.cpp b/servers/physics_2d/area_pair_2d_sw.cpp
index 669f27bcc8..0e70a626c2 100644
--- a/servers/physics_2d/area_pair_2d_sw.cpp
+++ b/servers/physics_2d/area_pair_2d_sw.cpp
@@ -37,7 +37,7 @@ bool AreaPair2DSW::setup(real_t p_step) {
if (area->is_shape_set_as_disabled(area_shape) || body->is_shape_set_as_disabled(body_shape)) {
result = false;
- } else if (area->test_collision_mask(body) && CollisionSolver2DSW::solve(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), Vector2(), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), Vector2(), NULL, this)) {
+ } else if (area->test_collision_mask(body) && CollisionSolver2DSW::solve(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), Vector2(), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), Vector2(), nullptr, this)) {
result = true;
}
@@ -100,7 +100,7 @@ bool Area2Pair2DSW::setup(real_t p_step) {
bool result = false;
if (area_a->is_shape_set_as_disabled(shape_a) || area_b->is_shape_set_as_disabled(shape_b)) {
result = false;
- } else if (area_a->test_collision_mask(area_b) && CollisionSolver2DSW::solve(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), Vector2(), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), Vector2(), NULL, this)) {
+ } else if (area_a->test_collision_mask(area_b) && CollisionSolver2DSW::solve(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), Vector2(), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), Vector2(), nullptr, this)) {
result = true;
}
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index 11cf1339bc..39e28fd002 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -538,8 +538,8 @@ void Body2DSW::integrate_forces(real_t p_step) {
_update_shapes_with_motion(motion);
}
- // damp_area=NULL; // clear the area, so it is set in the next frame
- def_area = NULL; // clear the area, so it is set in the next frame
+ // damp_area=nullptr; // clear the area, so it is set in the next frame
+ def_area = nullptr; // clear the area, so it is set in the next frame
contact_count = 0;
}
@@ -650,7 +650,7 @@ void Body2DSW::set_force_integration_callback(ObjectID p_id, const StringName &p
if (fi_callback) {
memdelete(fi_callback);
- fi_callback = NULL;
+ fi_callback = nullptr;
}
if (p_id.is_valid()) {
@@ -682,8 +682,8 @@ Body2DSW::Body2DSW() :
omit_force_integration = false;
applied_torque = 0;
island_step = 0;
- island_next = NULL;
- island_list_next = NULL;
+ island_next = nullptr;
+ island_list_next = nullptr;
_set_static(false);
first_time_kinematic = false;
linear_damp = -1;
@@ -697,7 +697,7 @@ Body2DSW::Body2DSW() :
still_time = 0;
continuous_cd_mode = PhysicsServer2D::CCD_MODE_DISABLED;
can_sleep = true;
- fi_callback = NULL;
+ fi_callback = nullptr;
}
Body2DSW::~Body2DSW() {
@@ -706,7 +706,7 @@ Body2DSW::~Body2DSW() {
memdelete(fi_callback);
}
-PhysicsDirectBodyState2DSW *PhysicsDirectBodyState2DSW::singleton = NULL;
+PhysicsDirectBodyState2DSW *PhysicsDirectBodyState2DSW::singleton = nullptr;
PhysicsDirectSpaceState2D *PhysicsDirectBodyState2DSW::get_space_state() {
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index e463377c7b..0514b263b4 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -419,7 +419,7 @@ public:
virtual real_t get_step() const { return step; }
PhysicsDirectBodyState2DSW() {
singleton = this;
- body = NULL;
+ body = nullptr;
}
};
diff --git a/servers/physics_2d/broad_phase_2d_basic.cpp b/servers/physics_2d/broad_phase_2d_basic.cpp
index 11bf8712ac..5e3a13f4dd 100644
--- a/servers/physics_2d/broad_phase_2d_basic.cpp
+++ b/servers/physics_2d/broad_phase_2d_basic.cpp
@@ -65,7 +65,7 @@ void BroadPhase2DBasic::remove(ID p_id) {
CollisionObject2DSW *BroadPhase2DBasic::get_object(ID p_id) const {
const Map<ID, Element>::Element *E = element_map.find(p_id);
- ERR_FAIL_COND_V(!E, NULL);
+ ERR_FAIL_COND_V(!E, nullptr);
return E->get().owner;
}
bool BroadPhase2DBasic::is_static(ID p_id) const {
@@ -158,7 +158,7 @@ void BroadPhase2DBasic::update() {
if (pair_ok && !E) {
- void *data = NULL;
+ void *data = nullptr;
if (pair_callback)
data = pair_callback(elem_A->owner, elem_A->subindex, elem_B->owner, elem_B->subindex, unpair_userdata);
pair_map.insert(key, data);
@@ -175,8 +175,8 @@ BroadPhase2DSW *BroadPhase2DBasic::_create() {
BroadPhase2DBasic::BroadPhase2DBasic() {
current = 1;
- unpair_callback = NULL;
- unpair_userdata = NULL;
- pair_callback = NULL;
- pair_userdata = NULL;
+ unpair_callback = nullptr;
+ unpair_userdata = nullptr;
+ pair_callback = nullptr;
+ pair_userdata = nullptr;
}
diff --git a/servers/physics_2d/broad_phase_2d_basic.h b/servers/physics_2d/broad_phase_2d_basic.h
index fea5668c89..7d02590af9 100644
--- a/servers/physics_2d/broad_phase_2d_basic.h
+++ b/servers/physics_2d/broad_phase_2d_basic.h
@@ -91,8 +91,8 @@ public:
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
- virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
+ virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
index 711ff9f1f7..2cb021258a 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
@@ -394,7 +394,7 @@ void BroadPhase2DHashGrid::remove(ID p_id) {
CollisionObject2DSW *BroadPhase2DHashGrid::get_object(ID p_id) const {
const Map<ID, Element>::Element *E = element_map.find(p_id);
- ERR_FAIL_COND_V(!E, NULL);
+ ERR_FAIL_COND_V(!E, nullptr);
return E->get().owner;
}
bool BroadPhase2DHashGrid::is_static(ID p_id) const {
@@ -646,7 +646,7 @@ BroadPhase2DHashGrid::BroadPhase2DHashGrid() {
ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/large_object_surface_threshold_in_cells", PropertyInfo(Variant::INT, "physics/2d/large_object_surface_threshold_in_cells", PROPERTY_HINT_RANGE, "0,1024,1,or_greater"));
for (uint32_t i = 0; i < hash_table_size; i++)
- hash_table[i] = NULL;
+ hash_table[i] = nullptr;
pass = 1;
current = 0;
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.h b/servers/physics_2d/broad_phase_2d_hash_grid.h
index e75b51c19d..dc29d0c619 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.h
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.h
@@ -44,7 +44,7 @@ class BroadPhase2DHashGrid : public BroadPhase2DSW {
PairData() {
colliding = false;
rc = 1;
- ud = NULL;
+ ud = nullptr;
}
};
@@ -177,8 +177,8 @@ public:
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
- virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
+ virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
diff --git a/servers/physics_2d/broad_phase_2d_sw.cpp b/servers/physics_2d/broad_phase_2d_sw.cpp
index c9e1dd8758..5ba557e70a 100644
--- a/servers/physics_2d/broad_phase_2d_sw.cpp
+++ b/servers/physics_2d/broad_phase_2d_sw.cpp
@@ -30,7 +30,7 @@
#include "broad_phase_2d_sw.h"
-BroadPhase2DSW::CreateFunction BroadPhase2DSW::create_func = NULL;
+BroadPhase2DSW::CreateFunction BroadPhase2DSW::create_func = nullptr;
BroadPhase2DSW::~BroadPhase2DSW() {
}
diff --git a/servers/physics_2d/broad_phase_2d_sw.h b/servers/physics_2d/broad_phase_2d_sw.h
index c7777d9d92..5e42c72d83 100644
--- a/servers/physics_2d/broad_phase_2d_sw.h
+++ b/servers/physics_2d/broad_phase_2d_sw.h
@@ -58,8 +58,8 @@ public:
virtual bool is_static(ID p_id) const = 0;
virtual int get_subindex(ID p_id) const = 0;
- virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
- virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
+ virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr) = 0;
+ virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr) = 0;
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata) = 0;
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) = 0;
diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp
index a6891372c2..0ec293c042 100644
--- a/servers/physics_2d/collision_object_2d_sw.cpp
+++ b/servers/physics_2d/collision_object_2d_sw.cpp
@@ -266,7 +266,7 @@ CollisionObject2DSW::CollisionObject2DSW(Type p_type) :
_static = true;
type = p_type;
- space = NULL;
+ space = nullptr;
collision_mask = 1;
collision_layer = 1;
pickable = true;
diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp
index 217c93c6da..a954cb3de3 100644
--- a/servers/physics_2d/collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/collision_solver_2d_sat.cpp
@@ -145,7 +145,7 @@ static void _generate_contacts_from_supports(const Vector2 *p_points_A, int p_po
_generate_contacts_point_edge,
},
{
- 0,
+ nullptr,
_generate_contacts_edge_edge,
}
};
@@ -1060,25 +1060,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<false, false, false>,
_collision_segment_capsule<false, false, false>,
_collision_segment_convex_polygon<false, false, false> },
- { 0,
+ { nullptr,
_collision_circle_circle<false, false, false>,
_collision_circle_rectangle<false, false, false>,
_collision_circle_capsule<false, false, false>,
_collision_circle_convex_polygon<false, false, false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<false, false, false>,
_collision_rectangle_capsule<false, false, false>,
_collision_rectangle_convex_polygon<false, false, false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<false, false, false>,
_collision_capsule_convex_polygon<false, false, false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false, false, false> }
};
@@ -1089,25 +1089,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<true, false, false>,
_collision_segment_capsule<true, false, false>,
_collision_segment_convex_polygon<true, false, false> },
- { 0,
+ { nullptr,
_collision_circle_circle<true, false, false>,
_collision_circle_rectangle<true, false, false>,
_collision_circle_capsule<true, false, false>,
_collision_circle_convex_polygon<true, false, false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<true, false, false>,
_collision_rectangle_capsule<true, false, false>,
_collision_rectangle_convex_polygon<true, false, false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<true, false, false>,
_collision_capsule_convex_polygon<true, false, false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true, false, false> }
};
@@ -1118,25 +1118,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<false, true, false>,
_collision_segment_capsule<false, true, false>,
_collision_segment_convex_polygon<false, true, false> },
- { 0,
+ { nullptr,
_collision_circle_circle<false, true, false>,
_collision_circle_rectangle<false, true, false>,
_collision_circle_capsule<false, true, false>,
_collision_circle_convex_polygon<false, true, false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<false, true, false>,
_collision_rectangle_capsule<false, true, false>,
_collision_rectangle_convex_polygon<false, true, false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<false, true, false>,
_collision_capsule_convex_polygon<false, true, false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false, true, false> }
};
@@ -1147,25 +1147,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<true, true, false>,
_collision_segment_capsule<true, true, false>,
_collision_segment_convex_polygon<true, true, false> },
- { 0,
+ { nullptr,
_collision_circle_circle<true, true, false>,
_collision_circle_rectangle<true, true, false>,
_collision_circle_capsule<true, true, false>,
_collision_circle_convex_polygon<true, true, false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<true, true, false>,
_collision_rectangle_capsule<true, true, false>,
_collision_rectangle_convex_polygon<true, true, false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<true, true, false>,
_collision_capsule_convex_polygon<true, true, false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true, true, false> }
};
@@ -1176,25 +1176,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<false, false, true>,
_collision_segment_capsule<false, false, true>,
_collision_segment_convex_polygon<false, false, true> },
- { 0,
+ { nullptr,
_collision_circle_circle<false, false, true>,
_collision_circle_rectangle<false, false, true>,
_collision_circle_capsule<false, false, true>,
_collision_circle_convex_polygon<false, false, true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<false, false, true>,
_collision_rectangle_capsule<false, false, true>,
_collision_rectangle_convex_polygon<false, false, true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<false, false, true>,
_collision_capsule_convex_polygon<false, false, true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false, false, true> }
};
@@ -1205,25 +1205,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<true, false, true>,
_collision_segment_capsule<true, false, true>,
_collision_segment_convex_polygon<true, false, true> },
- { 0,
+ { nullptr,
_collision_circle_circle<true, false, true>,
_collision_circle_rectangle<true, false, true>,
_collision_circle_capsule<true, false, true>,
_collision_circle_convex_polygon<true, false, true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<true, false, true>,
_collision_rectangle_capsule<true, false, true>,
_collision_rectangle_convex_polygon<true, false, true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<true, false, true>,
_collision_capsule_convex_polygon<true, false, true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true, false, true> }
};
@@ -1234,25 +1234,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<false, true, true>,
_collision_segment_capsule<false, true, true>,
_collision_segment_convex_polygon<false, true, true> },
- { 0,
+ { nullptr,
_collision_circle_circle<false, true, true>,
_collision_circle_rectangle<false, true, true>,
_collision_circle_capsule<false, true, true>,
_collision_circle_convex_polygon<false, true, true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<false, true, true>,
_collision_rectangle_capsule<false, true, true>,
_collision_rectangle_convex_polygon<false, true, true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<false, true, true>,
_collision_capsule_convex_polygon<false, true, true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false, true, true> }
};
@@ -1263,25 +1263,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<true, true, true>,
_collision_segment_capsule<true, true, true>,
_collision_segment_convex_polygon<true, true, true> },
- { 0,
+ { nullptr,
_collision_circle_circle<true, true, true>,
_collision_circle_rectangle<true, true, true>,
_collision_circle_capsule<true, true, true>,
_collision_circle_convex_polygon<true, true, true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<true, true, true>,
_collision_rectangle_capsule<true, true, true>,
_collision_rectangle_convex_polygon<true, true, true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<true, true, true>,
_collision_capsule_convex_polygon<true, true, true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true, true, true> }
};
diff --git a/servers/physics_2d/collision_solver_2d_sat.h b/servers/physics_2d/collision_solver_2d_sat.h
index 105cb9104d..6bb485f561 100644
--- a/servers/physics_2d/collision_solver_2d_sat.h
+++ b/servers/physics_2d/collision_solver_2d_sat.h
@@ -33,6 +33,6 @@
#include "collision_solver_2d_sw.h"
-bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector2 *sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
+bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector2 *sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
#endif // COLLISION_SOLVER_2D_SAT_H
diff --git a/servers/physics_2d/collision_solver_2d_sw.h b/servers/physics_2d/collision_solver_2d_sw.h
index e73ee8fd7e..f39cfee0a9 100644
--- a/servers/physics_2d/collision_solver_2d_sw.h
+++ b/servers/physics_2d/collision_solver_2d_sw.h
@@ -40,11 +40,11 @@ public:
private:
static bool solve_static_line(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
static void concave_callback(void *p_userdata, Shape2DSW *p_convex);
- static bool solve_concave(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
- static bool solve_raycast(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis = NULL);
+ static bool solve_concave(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
+ static bool solve_raycast(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis = nullptr);
public:
- static bool solve(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, Vector2 *sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
+ static bool solve(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, Vector2 *sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
};
#endif // COLLISION_SOLVER_2D_SW_H
diff --git a/servers/physics_2d/constraint_2d_sw.h b/servers/physics_2d/constraint_2d_sw.h
index b5c994cbdd..f8eb16214f 100644
--- a/servers/physics_2d/constraint_2d_sw.h
+++ b/servers/physics_2d/constraint_2d_sw.h
@@ -45,7 +45,7 @@ class Constraint2DSW {
RID self;
protected:
- Constraint2DSW(Body2DSW **p_body_ptr = NULL, int p_body_count = 0) {
+ Constraint2DSW(Body2DSW **p_body_ptr = nullptr, int p_body_count = 0) {
_body_ptr = p_body_ptr;
_body_count = p_body_count;
island_step = 0;
diff --git a/servers/physics_2d/joints_2d_sw.h b/servers/physics_2d/joints_2d_sw.h
index f4aeb6e3c8..a0d25dc70d 100644
--- a/servers/physics_2d/joints_2d_sw.h
+++ b/servers/physics_2d/joints_2d_sw.h
@@ -51,7 +51,7 @@ public:
_FORCE_INLINE_ real_t get_max_bias() const { return max_bias; }
virtual PhysicsServer2D::JointType get_type() const = 0;
- Joint2DSW(Body2DSW **p_body_ptr = NULL, int p_body_count = 0) :
+ Joint2DSW(Body2DSW **p_body_ptr = nullptr, int p_body_count = 0) :
Constraint2DSW(p_body_ptr, p_body_count) {
bias = 0;
max_force = max_bias = 3.40282e+38;
@@ -86,7 +86,7 @@ public:
void set_param(PhysicsServer2D::PinJointParam p_param, real_t p_value);
real_t get_param(PhysicsServer2D::PinJointParam p_param) const;
- PinJoint2DSW(const Vector2 &p_pos, Body2DSW *p_body_a, Body2DSW *p_body_b = NULL);
+ PinJoint2DSW(const Vector2 &p_pos, Body2DSW *p_body_a, Body2DSW *p_body_b = nullptr);
~PinJoint2DSW();
};
diff --git a/servers/physics_2d/physics_server_2d_sw.cpp b/servers/physics_2d/physics_server_2d_sw.cpp
index e2a482e960..871e2aba1d 100644
--- a/servers/physics_2d/physics_server_2d_sw.cpp
+++ b/servers/physics_2d/physics_server_2d_sw.cpp
@@ -42,7 +42,7 @@
RID PhysicsServer2DSW::_shape_create(ShapeType p_shape) {
- Shape2DSW *shape = NULL;
+ Shape2DSW *shape = nullptr;
switch (p_shape) {
case SHAPE_LINE: {
@@ -227,7 +227,7 @@ bool PhysicsServer2DSW::shape_collide(RID p_shape_A, const Transform2D &p_xform_
if (p_result_max == 0) {
- return CollisionSolver2DSW::solve(shape_A, p_xform_A, p_motion_A, shape_B, p_xform_B, p_motion_B, NULL, NULL);
+ return CollisionSolver2DSW::solve(shape_A, p_xform_A, p_motion_A, shape_B, p_xform_B, p_motion_B, nullptr, nullptr);
}
CollCbkData cbk;
@@ -313,8 +313,8 @@ int PhysicsServer2DSW::space_get_contact_count(RID p_space) const {
PhysicsDirectSpaceState2D *PhysicsServer2DSW::space_get_direct_state(RID p_space) {
Space2DSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, NULL);
- ERR_FAIL_COND_V_MSG((using_threads && !doing_sync) || space->is_locked(), NULL, "Space state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_COND_V(!space, nullptr);
+ ERR_FAIL_COND_V_MSG((using_threads && !doing_sync) || space->is_locked(), nullptr, "Space state is inaccessible right now, wait for iteration or physics process notification.");
return space->get_direct_state();
}
@@ -332,7 +332,7 @@ void PhysicsServer2DSW::area_set_space(RID p_area, RID p_space) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
- Space2DSW *space = NULL;
+ Space2DSW *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -596,7 +596,7 @@ void PhysicsServer2DSW::body_set_space(RID p_body, RID p_space) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
- Space2DSW *space = NULL;
+ Space2DSW *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -1069,15 +1069,15 @@ int PhysicsServer2DSW::body_test_ray_separation(RID p_body, const Transform2D &p
PhysicsDirectBodyState2D *PhysicsServer2DSW::body_get_direct_state(RID p_body) {
- ERR_FAIL_COND_V_MSG((using_threads && !doing_sync), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_COND_V_MSG((using_threads && !doing_sync), nullptr, "Body state is inaccessible right now, wait for iteration or physics process notification.");
if (!body_owner.owns(p_body))
- return NULL;
+ return nullptr;
Body2DSW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, NULL);
- ERR_FAIL_COND_V(!body->get_space(), NULL);
- ERR_FAIL_COND_V_MSG(body->get_space()->is_locked(), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_COND_V(!body, nullptr);
+ ERR_FAIL_COND_V(!body->get_space(), nullptr);
+ ERR_FAIL_COND_V_MSG(body->get_space()->is_locked(), nullptr, "Body state is inaccessible right now, wait for iteration or physics process notification.");
direct_state->body = body;
return direct_state;
@@ -1142,7 +1142,7 @@ RID PhysicsServer2DSW::pin_joint_create(const Vector2 &p_pos, RID p_body_a, RID
Body2DSW *A = body_owner.getornull(p_body_a);
ERR_FAIL_COND_V(!A, RID());
- Body2DSW *B = NULL;
+ Body2DSW *B = nullptr;
if (body_owner.owns(p_body_b)) {
B = body_owner.getornull(p_body_b);
ERR_FAIL_COND_V(!B, RID());
@@ -1276,7 +1276,7 @@ void PhysicsServer2DSW::free(RID p_rid) {
_clear_query(area->get_monitor_query());
*/
- area->set_space(NULL);
+ area->set_space(nullptr);
while (area->get_shape_count()) {
@@ -1291,7 +1291,7 @@ void PhysicsServer2DSW::free(RID p_rid) {
while (space->get_objects().size()) {
CollisionObject2DSW *co = (CollisionObject2DSW *)space->get_objects().front()->get();
- co->set_space(NULL);
+ co->set_space(nullptr);
}
active_spaces.erase(space);
@@ -1444,7 +1444,7 @@ int PhysicsServer2DSW::get_process_info(ProcessInfo p_info) {
return 0;
}
-PhysicsServer2DSW *PhysicsServer2DSW::singletonsw = NULL;
+PhysicsServer2DSW *PhysicsServer2DSW::singletonsw = nullptr;
PhysicsServer2DSW::PhysicsServer2DSW() {
diff --git a/servers/physics_2d/physics_server_2d_sw.h b/servers/physics_2d/physics_server_2d_sw.h
index 9dfa8bf474..918958ffe2 100644
--- a/servers/physics_2d/physics_server_2d_sw.h
+++ b/servers/physics_2d/physics_server_2d_sw.h
@@ -249,7 +249,7 @@ public:
virtual void body_set_pickable(RID p_body, bool p_pickable);
- virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true);
+ virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true);
virtual int body_test_ray_separation(RID p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001);
// this function only works on physics process, errors and returns null otherwise
diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.cpp b/servers/physics_2d/physics_server_2d_wrap_mt.cpp
index 5f65e296fd..0a89a76615 100644
--- a/servers/physics_2d/physics_server_2d_wrap_mt.cpp
+++ b/servers/physics_2d/physics_server_2d_wrap_mt.cpp
@@ -126,7 +126,7 @@ void PhysicsServer2DWrapMT::finish() {
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
} else {
physics_2d_server->finish();
}
@@ -150,7 +150,7 @@ PhysicsServer2DWrapMT::PhysicsServer2DWrapMT(PhysicsServer2D *p_contained, bool
physics_2d_server = p_contained;
create_thread = p_create_thread;
- thread = NULL;
+ thread = nullptr;
step_pending = 0;
step_thread_up = false;
diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.h b/servers/physics_2d/physics_server_2d_wrap_mt.h
index ffd46feebd..7e61927378 100644
--- a/servers/physics_2d/physics_server_2d_wrap_mt.h
+++ b/servers/physics_2d/physics_server_2d_wrap_mt.h
@@ -112,7 +112,7 @@ public:
// this function only works on physics process, errors and returns null otherwise
PhysicsDirectSpaceState2D *space_get_direct_state(RID p_space) {
- ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL);
+ ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), nullptr);
return physics_2d_server->space_get_direct_state(p_space);
}
@@ -255,7 +255,7 @@ public:
FUNC2(body_set_pickable, RID, bool);
- bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true) {
+ bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true) {
ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), false);
return physics_2d_server->body_test_motion(p_body, p_from, p_motion, p_infinite_inertia, p_margin, r_result, p_exclude_raycast_shapes);
@@ -270,7 +270,7 @@ public:
// this function only works on physics process, errors and returns null otherwise
PhysicsDirectBodyState2D *body_get_direct_state(RID p_body) {
- ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL);
+ ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), nullptr);
return physics_2d_server->body_get_direct_state(p_body);
}
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 5fefb9595f..06096d674a 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -643,7 +643,7 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) {
if (points)
memdelete_arr(points);
- points = NULL;
+ points = nullptr;
point_count = 0;
if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) {
@@ -706,7 +706,7 @@ Variant ConvexPolygonShape2DSW::get_data() const {
ConvexPolygonShape2DSW::ConvexPolygonShape2DSW() {
- points = NULL;
+ points = nullptr;
point_count = 0;
}
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index cba190995f..7ae2e9769f 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -222,7 +222,7 @@ int PhysicsDirectSpaceState2DSW::intersect_shape(const RID &p_shape, const Trans
const CollisionObject2DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
- if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), NULL, NULL, NULL, p_margin))
+ if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), nullptr, nullptr, nullptr, p_margin))
continue;
r_results[cc].collider_id = col_obj->get_instance_id();
@@ -265,12 +265,12 @@ bool PhysicsDirectSpaceState2DSW::cast_motion(const RID &p_shape, const Transfor
Transform2D col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
//test initial overlap, does it collide if going all the way?
- if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, NULL, p_margin)) {
+ if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), nullptr, nullptr, nullptr, p_margin)) {
continue;
}
//test initial overlap
- if (CollisionSolver2DSW::solve(shape, p_xform, Vector2(), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, NULL, p_margin)) {
+ if (CollisionSolver2DSW::solve(shape, p_xform, Vector2(), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), nullptr, nullptr, nullptr, p_margin)) {
return false;
}
@@ -285,7 +285,7 @@ bool PhysicsDirectSpaceState2DSW::cast_motion(const RID &p_shape, const Transfor
real_t ofs = (low + hi) * 0.5;
Vector2 sep = mnormal; //important optimization for this to work fast enough
- bool collided = CollisionSolver2DSW::solve(shape, p_xform, p_motion * ofs, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, &sep, p_margin);
+ bool collided = CollisionSolver2DSW::solve(shape, p_xform, p_motion * ofs, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), nullptr, nullptr, &sep, p_margin);
if (collided) {
@@ -348,7 +348,7 @@ bool PhysicsDirectSpaceState2DSW::collide_shape(RID p_shape, const Transform2D &
cbk.valid_dir = Vector2();
cbk.valid_depth = 0;
- if (CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), cbkres, cbkptr, nullptr, p_margin)) {
collided = cbk.amount > 0;
}
}
@@ -415,7 +415,7 @@ bool PhysicsDirectSpaceState2DSW::rest_info(RID p_shape, const Transform2D &p_sh
_RestCallbackData2D rcd;
rcd.best_len = 0;
- rcd.best_object = NULL;
+ rcd.best_object = nullptr;
rcd.best_shape = 0;
rcd.min_allowed_depth = space->test_motion_min_contact_depth;
@@ -435,7 +435,7 @@ bool PhysicsDirectSpaceState2DSW::rest_info(RID p_shape, const Transform2D &p_sh
rcd.object = col_obj;
rcd.shape = shape_idx;
rcd.local_shape = 0;
- bool sc = CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), _rest_cbk_result, &rcd, NULL, p_margin);
+ bool sc = CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), _rest_cbk_result, &rcd, nullptr, p_margin);
if (!sc)
continue;
}
@@ -464,7 +464,7 @@ bool PhysicsDirectSpaceState2DSW::rest_info(RID p_shape, const Transform2D &p_sh
PhysicsDirectSpaceState2DSW::PhysicsDirectSpaceState2DSW() {
- space = NULL;
+ space = nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -613,7 +613,7 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t
*/
Shape2DSW *against_shape = col_obj->get_shape(shape_idx);
- if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), cbkres, cbkptr, nullptr, p_margin)) {
if (cbk.amount > 0) {
collided = true;
}
@@ -818,7 +818,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
bool did_collide = false;
Shape2DSW *against_shape = col_obj->get_shape(shape_idx);
- if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), cbkres, cbkptr, NULL, separation_margin)) {
+ if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), cbkres, cbkptr, nullptr, separation_margin)) {
did_collide = cbk.passed > current_passed; //more passed, so collision actually existed
}
@@ -925,12 +925,12 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
Transform2D col_obj_shape_xform = col_obj->get_transform() * col_obj->get_shape_transform(col_shape_idx);
//test initial overlap, does it collide if going all the way?
- if (!CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion, against_shape, col_obj_shape_xform, Vector2(), NULL, NULL, NULL, 0)) {
+ if (!CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion, against_shape, col_obj_shape_xform, Vector2(), nullptr, nullptr, nullptr, 0)) {
continue;
}
//test initial overlap
- if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), NULL, NULL, NULL, 0)) {
+ if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), nullptr, nullptr, nullptr, 0)) {
if (col_obj->is_shape_set_as_one_way_collision(col_shape_idx)) {
continue;
@@ -950,7 +950,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
real_t ofs = (low + hi) * 0.5;
Vector2 sep = mnormal; //important optimization for this to work fast enough
- bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * ofs, against_shape, col_obj_shape_xform, Vector2(), NULL, NULL, &sep, 0);
+ bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * ofs, against_shape, col_obj_shape_xform, Vector2(), nullptr, nullptr, &sep, 0);
if (collided) {
@@ -1018,7 +1018,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
_RestCallbackData2D rcd;
rcd.best_len = 0;
- rcd.best_object = NULL;
+ rcd.best_object = nullptr;
rcd.best_shape = 0;
rcd.min_allowed_depth = test_motion_min_contact_depth;
@@ -1081,7 +1081,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
rcd.object = col_obj;
rcd.shape = shape_idx;
rcd.local_shape = j;
- bool sc = CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), _rest_cbk_result, &rcd, NULL, p_margin);
+ bool sc = CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), _rest_cbk_result, &rcd, nullptr, p_margin);
if (!sc)
continue;
}
@@ -1156,7 +1156,7 @@ void *Space2DSW::_broadphase_pair(CollisionObject2DSW *A, int p_subindex_A, Coll
return b;
}
- return NULL;
+ return nullptr;
}
void Space2DSW::_broadphase_unpair(CollisionObject2DSW *A, int p_subindex_A, CollisionObject2DSW *B, int p_subindex_B, void *p_data, void *p_self) {
@@ -1351,7 +1351,7 @@ Space2DSW::Space2DSW() {
broadphase = BroadPhase2DSW::create_func();
broadphase->set_pair_callback(_broadphase_pair, this);
broadphase->set_unpair_callback(_broadphase_unpair, this);
- area = NULL;
+ area = nullptr;
direct_access = memnew(PhysicsDirectSpaceState2DSW);
direct_access->space = this;
diff --git a/servers/physics_2d/step_2d_sw.cpp b/servers/physics_2d/step_2d_sw.cpp
index 198fccdb80..6f3bcfec13 100644
--- a/servers/physics_2d/step_2d_sw.cpp
+++ b/servers/physics_2d/step_2d_sw.cpp
@@ -60,7 +60,7 @@ void Step2DSW::_populate_island(Body2DSW *p_body, Body2DSW **p_island, Constrain
bool Step2DSW::_setup_island(Constraint2DSW *p_island, real_t p_delta) {
Constraint2DSW *ci = p_island;
- Constraint2DSW *prev_ci = NULL;
+ Constraint2DSW *prev_ci = nullptr;
bool removed_root = false;
while (ci) {
bool process = ci->setup(p_delta);
@@ -164,8 +164,8 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
/* GENERATE CONSTRAINT ISLANDS */
- Body2DSW *island_list = NULL;
- Constraint2DSW *constraint_island_list = NULL;
+ Body2DSW *island_list = nullptr;
+ Constraint2DSW *constraint_island_list = nullptr;
b = body_list->first();
int island_count = 0;
@@ -175,8 +175,8 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
if (body->get_island_step() != _step) {
- Body2DSW *island = NULL;
- Constraint2DSW *constraint_island = NULL;
+ Body2DSW *island = nullptr;
+ Constraint2DSW *constraint_island = nullptr;
_populate_island(body, &island, &constraint_island);
island->set_island_list_next(island_list);
@@ -202,7 +202,7 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
if (c->get_island_step() == _step)
continue;
c->set_island_step(_step);
- c->set_island_next(NULL);
+ c->set_island_next(nullptr);
c->set_island_list_next(constraint_island_list);
constraint_island_list = c;
}
@@ -219,7 +219,7 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
{
Constraint2DSW *ci = constraint_island_list;
- Constraint2DSW *prev_ci = NULL;
+ Constraint2DSW *prev_ci = nullptr;
while (ci) {
if (_setup_island(ci, p_delta)) {