Use C++ iterators for Lists in many situations
This commit is contained in:
@@ -532,13 +532,13 @@ void Body2DSW::integrate_velocities(real_t p_step) {
|
||||
}
|
||||
|
||||
void Body2DSW::wakeup_neighbours() {
|
||||
for (List<Pair<Constraint2DSW *, int>>::Element *E = constraint_list.front(); E; E = E->next()) {
|
||||
const Constraint2DSW *c = E->get().first;
|
||||
for (Pair<Constraint2DSW *, int> &E : constraint_list) {
|
||||
const Constraint2DSW *c = E.first;
|
||||
Body2DSW **n = c->get_body_ptr();
|
||||
int bc = c->get_body_count();
|
||||
|
||||
for (int i = 0; i < bc; i++) {
|
||||
if (i == E->get().second) {
|
||||
if (i == E.second) {
|
||||
continue;
|
||||
}
|
||||
Body2DSW *b = n[i];
|
||||
|
||||
@@ -46,8 +46,8 @@ void Step2DSW::_populate_island(Body2DSW *p_body, LocalVector<Body2DSW *> &p_bod
|
||||
p_body_island.push_back(p_body);
|
||||
}
|
||||
|
||||
for (const List<Pair<Constraint2DSW *, int>>::Element *E = p_body->get_constraint_list().front(); E; E = E->next()) {
|
||||
Constraint2DSW *constraint = (Constraint2DSW *)E->get().first;
|
||||
for (const Pair<Constraint2DSW *, int> &E : p_body->get_constraint_list()) {
|
||||
Constraint2DSW *constraint = (Constraint2DSW *)E.first;
|
||||
if (constraint->get_island_step() == _step) {
|
||||
continue; // Already processed.
|
||||
}
|
||||
@@ -56,7 +56,7 @@ void Step2DSW::_populate_island(Body2DSW *p_body, LocalVector<Body2DSW *> &p_bod
|
||||
all_constraints.push_back(constraint);
|
||||
|
||||
for (int i = 0; i < constraint->get_body_count(); i++) {
|
||||
if (i == E->get().second) {
|
||||
if (i == E.second) {
|
||||
continue;
|
||||
}
|
||||
Body2DSW *other_body = constraint->get_body_ptr()[i];
|
||||
|
||||
Reference in New Issue
Block a user