- added tons of divide-by-zero protection all over the place

- general cleanup of values passed to UpdateBar
This commit is contained in:
Parnic
2009-04-18 21:07:42 +00:00
parent f11192bfd1
commit 10af4566d6
16 changed files with 24 additions and 19 deletions

View File

@ -135,10 +135,10 @@ function IceCastBar.prototype:OnUpdate()
-- handle casting and channeling
if (self.action == IceCastBar.Actions.Cast or self.action == IceCastBar.Actions.Channel) then
local remainingTime = self.actionStartTime + self.actionDuration - time
local scale = 1 - (remainingTime / self.actionDuration)
local scale = 1 - (self.actionDuration > 0 and remainingTime / self.actionDuration or 0)
if (self.action == IceCastBar.Actions.Channel) then
scale = remainingTime / self.actionDuration
scale = self.actionDuration > 0 and remainingTime / self.actionDuration or 0
end
if (remainingTime < 0) then