From 86d38f50ee852d4c1d16bd40eccc6623f50487fc Mon Sep 17 00:00:00 2001 From: Parnic Date: Tue, 26 Apr 2011 04:30:16 +0000 Subject: [PATCH] - 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. --- IceCore.lua | 9 +++++++-- modules/CustomCDBar.lua | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/IceCore.lua b/IceCore.lua index 211e571..8fc1779 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -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() diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index 39b62aa..a12de04 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -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