This commit is contained in:
J. Nick Koston 2025-07-22 15:46:49 -10:00
parent 0b9b33b81b
commit e6961f8f24
No known key found for this signature in database

View File

@ -271,24 +271,16 @@ void Application::calculate_looping_components_() {
// Pre-reserve vector to avoid reallocations
this->looping_components_.reserve(total_looping);
// First add all active components
// Add all components with loop override
// When called at start of setup, all components are in CONSTRUCTION state
// so none will be LOOP_DONE yet - they'll all go in the active section
for (auto *obj : this->components_) {
if (obj->has_overridden_loop() &&
(obj->get_component_state() & COMPONENT_STATE_MASK) != COMPONENT_STATE_LOOP_DONE) {
if (obj->has_overridden_loop()) {
this->looping_components_.push_back(obj);
}
}
this->looping_components_active_end_ = this->looping_components_.size();
// Then add all inactive (LOOP_DONE) components
// This handles components that called disable_loop() during setup, before this method runs
for (auto *obj : this->components_) {
if (obj->has_overridden_loop() &&
(obj->get_component_state() & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP_DONE) {
this->looping_components_.push_back(obj);
}
}
}
void Application::disable_component_loop_(Component *component) {