Prevent taint in UpdateAction

This commit is contained in:
Hendrik Leppkes
2008-11-09 15:46:50 +01:00
parent 170b8253cd
commit 293e41b7d2
+5 -14
View File
@@ -262,9 +262,6 @@ function Button:Update()
end end
function Button:UpdateAction(force) function Button:UpdateAction(force)
if force then
self.action = 0
end
ActionButton_UpdateAction(self) ActionButton_UpdateAction(self)
end end
@@ -276,7 +273,7 @@ function Button:ToggleButtonElements()
end end
end end
local orig_ActionButton_UpdateHotkeys = ActionButton_UpdateHotkeys orig_ActionButton_UpdateHotkeys = ActionButton_UpdateHotkeys
ActionButton_UpdateHotkeys = function(self, ...) ActionButton_UpdateHotkeys = function(self, ...)
local name = self:GetName() local name = self:GetName()
if name and name:find("^BT4Button") then if name and name:find("^BT4Button") then
@@ -360,17 +357,11 @@ function Button:GetActionName()
return format(actionTmpl, self.parent.id, self.rid) return format(actionTmpl, self.parent.id, self.rid)
end end
local orig_ActionButton_UpdateUsable = ActionButton_UpdateUsable hooksecurefunc("ActionButton_UpdateUsable", function(self)
ActionButton_UpdateUsable = function(self, ...) if self.BT4init then
local name = self:GetName() self:UpdateUsable()
if name and name:find("^BT4Button") then
if self.BT4init then
self:UpdateUsable()
end
else
orig_ActionButton_UpdateUsable(self, ...)
end end
end end)
function Button:UpdateUsable(force) function Button:UpdateUsable(force)
local isUsable, notEnoughMana = IsUsableAction(self.action) local isUsable, notEnoughMana = IsUsableAction(self.action)