- fixed custom cooldown bars not working quite right with the 'When ready' display mode. the update subscription query was returning a false positive because a block of code in one of the CD bar's parent classes had already subscribed for updates, but the CD bar wanted to use its own update function.

This commit is contained in:
Parnic
2011-04-26 04:30:16 +00:00
parent 26541f1ced
commit 86d38f50ee
2 changed files with 12 additions and 7 deletions

View File

@ -854,6 +854,7 @@ function IceCore.prototype:RequestUpdates(module, func)
local count = 0
for k,v in pairs(self.updatees) do
count = count + 1
break
end
if (count == 0) then
@ -869,8 +870,12 @@ function IceCore.prototype:RequestUpdates(module, func)
end
end
function IceCore.prototype:IsUpdateSubscribed(module)
return self.updatees[module] ~= nil
function IceCore.prototype:IsUpdateSubscribed(module, func)
if func == nil then
return self.updatees[module] ~= nil
else
return self.updatees[module] == func
end
end
function IceCore.prototype:EmptyUpdates()

View File

@ -522,7 +522,7 @@ function IceCustomCDBar.prototype:EnableUpdates(enable_update)
-- There is a hole in the logic here for spells that can be cast on any friendly target. When
-- the correct UI option is selected they will cast on self when no target is selected. Deal
-- with that later if it turns out to be a problem.
if (not enable and (self.moduleSettings.displayMode == "When ready")--[[ and (IsUsableSpell(self.moduleSettings.cooldownToTrack) == 1)]]) then
if (not enable_update and (self.moduleSettings.displayMode == "When ready")--[[ and (IsUsableSpell(self.moduleSettings.cooldownToTrack) == 1)]]) then
-- Parnic: there are too many edge cases for "when ready" cooldowns that cause the bar to not appear when it should
-- so, i'm forcing updates to always run for any bar that's set to only show "when ready"
-- if SpellHasRange(self.moduleSettings.cooldownToTrack) then
@ -535,11 +535,11 @@ function IceCustomCDBar.prototype:EnableUpdates(enable_update)
end
if enable_update then
if not IceHUD.IceCore:IsUpdateSubscribed(self) then
if not self.CustomUpdateFunc then
self.CustomUpdateFunc = function() self:UpdateCustomBar(true) end
end
if not self.CustomUpdateFunc then
self.CustomUpdateFunc = function() self:UpdateCustomBar(true) end
end
if not IceHUD.IceCore:IsUpdateSubscribed(self, self.CustomUpdateFunc) then
IceHUD.IceCore:RequestUpdates(self, self.CustomUpdateFunc)
end
else