summaryrefslogtreecommitdiff
path: root/servers/physics_2d/physics_2d_server_sw.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2017-09-09 21:45:14 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2017-09-09 21:45:22 +0200
commitfbeb27b01d2dd94c80f9ae8ecf1dfd69a1bb55a6 (patch)
treee62385d263e54e8fd0d715e565b1f32dd6a9a44d /servers/physics_2d/physics_2d_server_sw.cpp
parentd8584682f03c2b78ac531f1e7537a10d6a5787d3 (diff)
Remove joint freeing logic from physics servers
Since joint resources are created by joint nodes and also they take care of freeing them, the physics server doesn't need to free bodies' joints explicitly. The logic for clearing the constraints map/set is still relevant as there may be collision pairs and in their case its the server itself the one creating them and therefore releasing them.
Diffstat (limited to 'servers/physics_2d/physics_2d_server_sw.cpp')
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp14
1 files changed, 0 insertions, 14 deletions
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index 006c5fd7b5..773ee374c3 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -296,14 +296,7 @@ void Physics2DServerSW::area_set_space(RID p_area, RID p_space) {
if (area->get_space() == space)
return; //pointless
- for (Set<Constraint2DSW *>::Element *E = area->get_constraints().front(); E; E = E->next()) {
- RID self = E->get()->get_self();
- if (!self.is_valid())
- continue;
- free(self);
- }
area->clear_constraints();
-
area->set_space(space);
};
@@ -548,14 +541,7 @@ void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {
if (body->get_space() == space)
return; //pointless
- for (Map<Constraint2DSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) {
- RID self = E->key()->get_self();
- if (!self.is_valid())
- continue;
- free(self);
- }
body->clear_constraint_map();
-
body->set_space(space);
};