From cd5d38d921a259004901e09bc676e20d94cb27cb Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Thu, 22 Oct 2026 02:11:40 -0500 Subject: [PATCH] perf(lossofcontrol): find control-loss debuffs in one aura walk The per-frame list asked FindNthSlot for the 1st, 2nd, ... harmful aura, and each call rescanned all 48 slots. Walk the harmful order once with the same filter instead: the same slots in UnitDebuff's order, one pass instead of up to n x 48 checks. Entries and events are unchanged. --- src/lossofcontrol/Info.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lossofcontrol/Info.cpp b/src/lossofcontrol/Info.cpp index f60096a0..53443346 100644 --- a/src/lossofcontrol/Info.cpp +++ b/src/lossofcontrol/Info.cpp @@ -175,15 +175,18 @@ int BuildList(LocEntry *out, int maxOut) { } } - // CC debuffs on the player. + // CC debuffs on the player, in UnitDebuff's order: one walk of the + // harmful order, the slots FindNthSlot would hand out for 1, 2, ... const uint8_t *player = Unit::Identity::PlayerObject(); if (player != nullptr) { const uint64_t playerGuid = Unit::Identity::PlayerGuid(); - for (int i = 1; n < maxOut; ++i) { - const int slot = Aura::Data::FindNthSlot( - player, i, Aura::Data::Filter::Harmful, Aura::Data::Match{}); - if (slot < 0) - break; + int order[Offsets::UNIT_AURA_TOTAL]; + Aura::Data::WalkOrder(player, Aura::Data::Filter::Harmful, order); + for (int i = 0; i < Offsets::UNIT_AURA_TOTAL && n < maxOut; ++i) { + const int slot = order[i]; + if (!Aura::Data::SlotMatchesFilter(player, slot, Aura::Data::Filter::Harmful, + Aura::Data::Match{})) + continue; const uint32_t spellID = Aura::Data::ReadSpellID(player, slot); if (spellID == 0) continue;