Use C++ iterators for Lists in many situations

This commit is contained in:
Aaron Franke
2021-07-15 23:45:57 -04:00
parent b918c4c3ce
commit 4e6efd1b07
218 changed files with 2755 additions and 3004 deletions

View File

@ -46,8 +46,8 @@ void Tween::start_tweeners() {
ERR_FAIL_MSG("Tween without commands, aborting.");
}
for (List<Ref<Tweener>>::Element *E = tweeners.write[current_step].front(); E; E = E->next()) {
E->get()->start();
for (Ref<Tweener> E : tweeners.write[current_step]) {
E->start();
}
}
@ -253,11 +253,11 @@ bool Tween::step(float p_delta) {
float step_delta = rem_delta;
step_active = false;
for (List<Ref<Tweener>>::Element *E = tweeners.write[current_step].front(); E; E = E->next()) {
for (Ref<Tweener> E : tweeners.write[current_step]) {
// Modified inside Tweener.step().
float temp_delta = rem_delta;
// Turns to true if any Tweener returns true (i.e. is still not finished).
step_active = E->get()->step(temp_delta) || step_active;
step_active = E->step(temp_delta) || step_active;
step_delta = MIN(temp_delta, rem_delta);
}