From eb881e1d6d1ecbc43e6f2afb3fdc9b391c4da67a Mon Sep 17 00:00:00 2001 From: Alex Foster <123afoster@gmail.com> Date: Wed, 11 Oct 2023 22:53:02 -0700 Subject: [PATCH] range based for loop in texture::compactvslots --- src/engine/render/texture.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/engine/render/texture.cpp b/src/engine/render/texture.cpp index 69b155e64..e7f98ddc7 100644 --- a/src/engine/render/texture.cpp +++ b/src/engine/render/texture.cpp @@ -1262,14 +1262,13 @@ int cubeworld::compactvslots(bool cull) } else { - for(uint i = 0; i < slots.size(); i++) + for(const Slot *i : slots) { - slots[i]->variants->index = compactedvslots++; + i->variants->index = compactedvslots++; } - for(uint i = 0; i < vslots.size(); i++) + for(const VSlot *i : vslots) { - VSlot &vs = *vslots[i]; - if(!vs.changed && vs.index < 0) + if(!i->changed && i->index < 0) { markingvslots = true; break; @@ -1279,22 +1278,21 @@ int cubeworld::compactvslots(bool cull) ::compactvslots(worldroot->data()); int total = compactedvslots; compacteditvslots(); - for(uint i = 0; i < vslots.size(); i++) + for(VSlot *i : vslots) { - VSlot *vs = vslots[i]; - if(vs->changed) + if(i->changed) { continue; } - while(vs->next) + while(i->next) { - if(vs->next->index < 0) + if(i->next->index < 0) { - vs->next = vs->next->next; + i->next = i->next->next; } else { - vs = vs->next; + i = i->next; } } }