From 7b7dc99ea504ef206d00c696edb7144254dc6149 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Wed, 6 Nov 2013 17:23:18 +0000 Subject: [PATCH] Fix ticket 312 - TimeToDie not working. Timespan computations were not working when the start a time interval was infinity (math.huge). Clamp the time to die to be a very large number instead of infinity so that (start, math.huge) is still a valid timespan. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1125 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleCondition.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OvaleCondition.lua b/OvaleCondition.lua index bf4b2c1..5f48281 100644 --- a/OvaleCondition.lua +++ b/OvaleCondition.lua @@ -422,12 +422,17 @@ local function TimeToDie(unitId) end end local dps = self_lastTTDdps[unitId] - if dps and dps > health / 3600 then + if dps and dps > 0 then timeToDie = health / dps else timeToDie = math.huge end end + -- Clamp time to die at a finite number. + if timeToDie == math.huge then + -- Return time to die in the far-off future (one week). + timeToDie = 3600 * 24 * 7 + end return timeToDie, health, maxHealth end -- -- 1.7.9.5