diff options
author | Lightning_A <aaronjrecord@gmail.com> | 2021-08-09 14:13:42 -0600 |
---|---|---|
committer | Lightning_A <aaronjrecord@gmail.com> | 2021-09-30 15:09:12 -0600 |
commit | c63b18507d21b8a213c073bced9057b571cdcd7a (patch) | |
tree | 96b8f7532ae5d923b75bfbac8d6763015b6646bb /servers/physics_3d | |
parent | e4dfa69bcf58e4d50acdde32c590364e43fce3ab (diff) |
Use range iterators for `Map`
Diffstat (limited to 'servers/physics_3d')
-rw-r--r-- | servers/physics_3d/body_3d_sw.cpp | 6 | ||||
-rw-r--r-- | servers/physics_3d/shape_3d_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics_3d/step_3d_sw.cpp | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/servers/physics_3d/body_3d_sw.cpp b/servers/physics_3d/body_3d_sw.cpp index 91fe80a3dc..069374d122 100644 --- a/servers/physics_3d/body_3d_sw.cpp +++ b/servers/physics_3d/body_3d_sw.cpp @@ -688,13 +688,13 @@ void BodySW::simulate_motion(const Transform3D& p_xform,real_t p_step) { */ void Body3DSW::wakeup_neighbours() { - for (Map<Constraint3DSW *, int>::Element *E = constraint_map.front(); E; E = E->next()) { - const Constraint3DSW *c = E->key(); + for (const KeyValue<Constraint3DSW *, int> &E : constraint_map) { + const Constraint3DSW *c = E.key; Body3DSW **n = c->get_body_ptr(); int bc = c->get_body_count(); for (int i = 0; i < bc; i++) { - if (i == E->get()) { + if (i == E.value) { continue; } Body3DSW *b = n[i]; diff --git a/servers/physics_3d/shape_3d_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp index 7deddb000e..0fb6d582c8 100644 --- a/servers/physics_3d/shape_3d_sw.cpp +++ b/servers/physics_3d/shape_3d_sw.cpp @@ -61,8 +61,8 @@ subject to the following restrictions: void Shape3DSW::configure(const AABB &p_aabb) { aabb = p_aabb; configured = true; - for (Map<ShapeOwner3DSW *, int>::Element *E = owners.front(); E; E = E->next()) { - ShapeOwner3DSW *co = (ShapeOwner3DSW *)E->key(); + for (const KeyValue<ShapeOwner3DSW *, int> &E : owners) { + ShapeOwner3DSW *co = (ShapeOwner3DSW *)E.key; co->_shape_changed(); } } diff --git a/servers/physics_3d/step_3d_sw.cpp b/servers/physics_3d/step_3d_sw.cpp index 7c18944b4d..6572d58c91 100644 --- a/servers/physics_3d/step_3d_sw.cpp +++ b/servers/physics_3d/step_3d_sw.cpp @@ -47,8 +47,8 @@ void Step3DSW::_populate_island(Body3DSW *p_body, LocalVector<Body3DSW *> &p_bod p_body_island.push_back(p_body); } - for (Map<Constraint3DSW *, int>::Element *E = p_body->get_constraint_map().front(); E; E = E->next()) { - Constraint3DSW *constraint = (Constraint3DSW *)E->key(); + for (const KeyValue<Constraint3DSW *, int> &E : p_body->get_constraint_map()) { + Constraint3DSW *constraint = (Constraint3DSW *)E.key; if (constraint->get_island_step() == _step) { continue; // Already processed. } @@ -59,7 +59,7 @@ void Step3DSW::_populate_island(Body3DSW *p_body, LocalVector<Body3DSW *> &p_bod // Find connected rigid bodies. for (int i = 0; i < constraint->get_body_count(); i++) { - if (i == E->get()) { + if (i == E.value) { continue; } Body3DSW *other_body = constraint->get_body_ptr()[i]; |