mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-05 21:20:00 +00:00
Draw the loot history and map overlays from real pools
Both modules had already grown a pool by hand. loothistory kept usedPlayers / freePlayers tables with a recycle loop and a table.remove acquire; mapreveal kept pfOverlays keyed by index, a pfOverlayMax high-water mark, and a hide-the-tail loop. Replace both with ClassicAPI's Pools.lua backport, which is what modules/tooltip.lua already uses for its buff icons. The map explore icons change shape rather than just plumbing. Everything constant -- size, scripts, mouse, frame level, the magnifying glass texture -- moves into the pool's creator instead of being re-set on every overlay on every map update, and the acquire moves inside the visibility test. The old loop built and configured an icon for every overlay in the zone and then hid most of them again; with "mapexploration" off it built the whole set and hid all of them. Now nothing is acquired for an icon that will not be shown. The tile textures lose their pfRevealN names, since pools create anonymous regions. They were already unique, so nothing was being clobbered -- this only costs their labels in /fstack.
This commit is contained in:
+6
-17
@@ -104,7 +104,6 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
-- Frame pools
|
||||
-- ==========================================================================
|
||||
local itemFrames = {}
|
||||
local usedPlayers, freePlayers = {}, {}
|
||||
|
||||
local FullUpdate -- forward declaration (toggle handlers call it)
|
||||
|
||||
@@ -204,20 +203,10 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
return f
|
||||
end
|
||||
|
||||
local function RecycleAllPlayers()
|
||||
for i = 1, table.getn(usedPlayers) do
|
||||
local pf = usedPlayers[i]
|
||||
pf:Hide()
|
||||
table.insert(freePlayers, pf)
|
||||
end
|
||||
usedPlayers = {}
|
||||
end
|
||||
|
||||
local function GetPlayerFrame()
|
||||
local pf = table.remove(freePlayers) or CreatePlayerFrame()
|
||||
table.insert(usedPlayers, pf)
|
||||
return pf
|
||||
end
|
||||
local playerPool = CreateObjectPool(CreatePlayerFrame, function(_, pf)
|
||||
pf:Hide()
|
||||
pf:ClearAllPoints()
|
||||
end)
|
||||
|
||||
local function SetToggleTexture(toggle, isExpanded)
|
||||
if isExpanded then
|
||||
@@ -309,7 +298,7 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
|
||||
function FullUpdate()
|
||||
if not pfUI.loothistory:IsShown() then return end
|
||||
RecycleAllPlayers()
|
||||
playerPool:ReleaseAll()
|
||||
|
||||
local num = C_LootHistory.GetNumItems()
|
||||
local y = -2
|
||||
@@ -327,7 +316,7 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
for p = 1, f.numPlayers do
|
||||
local name, class, rollType, roll, isWinner, isMe = C_LootHistory.GetPlayerInfo(i, p)
|
||||
if ShouldDisplayPlayer(f.isDone, roll, isMe) then
|
||||
local pf = GetPlayerFrame()
|
||||
local pf = playerPool:Acquire()
|
||||
RenderPlayerFrame(pf, name, class, rollType, roll, isWinner)
|
||||
pf:ClearAllPoints()
|
||||
pf:SetPoint("TOPLEFT", list, "TOPLEFT", 22, y)
|
||||
|
||||
Reference in New Issue
Block a user