We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4f2e740 + 3a91a69 commit a8099dbCopy full SHA for a8099db
1 file changed
src/limitless/lighting/light_container.cpp
@@ -87,13 +87,22 @@ Light& LightContainer::add(const Light& light) {
87
88
void LightContainer::update() {
89
// check if there were an update to lights
90
- bool changed {};
91
- for (auto& [id, light]: lights) {
92
- // if changed since last update
93
- if (light.isChanged()) {
94
- // update corresponding internal presentation
95
- internal_lights.at(id).update(light);
+ bool changed = false;
+
+ auto it = lights.begin();
+ while (it != lights.end()) {
+ auto& [id, light] = *it;
+ if (light.isRemoved()) {
96
+ internal_lights.erase(id);
97
+ it = lights.erase(it);
98
changed = true;
99
100
+ } else {
101
+ if (light.isChanged()) {
102
+ internal_lights.at(id).update(light);
103
+ changed = true;
104
+ }
105
+ ++it;
106
}
107
108
0 commit comments