From 0bd3f17799dd169b8655eddcf29ac2a6220f7ca8 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Thu, 7 Nov 2013 00:06:59 +0000 Subject: [PATCH] Fix bug where a table wasn't cleared before re-using. This fixes problems with using comparison operators noted by @Wiljo. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1131 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleBestAction.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua index 8ae3528..64ece77 100644 --- a/OvaleBestAction.lua +++ b/OvaleBestAction.lua @@ -270,6 +270,7 @@ local function ComputeArithmetic(element) end local scratch = OvaleTimeSpan(self_pool:Get()) scratch:Reset(timeSpan) + timeSpan:Reset() IntersectInterval(scratch, atTime - bound, atTime + bound, timeSpan) self_pool:Release(scratch) elseif element.operator == "%" then @@ -338,7 +339,10 @@ local function ComputeCompare(element) else local scratch = OvaleTimeSpan(self_pool:Get()) scratch:Reset(timeSpan) + timeSpan:Reset() local t = (B - A)/(c - z) + t = (t > 0) and t or 0 + Ovale:Logf("t = %f", t) if (c > z and operator == "<") or (c > z and operator == "<=") or (c < z and operator == ">") @@ -349,8 +353,6 @@ local function ComputeCompare(element) or (c > z and operator == ">") or (c > z and operator == ">=") then IntersectInterval(scratch, t, math.huge, timeSpan) - else -- if c ~= z and operator == "==" then - timeSpan:Reset() end self_pool:Release(scratch) end -- 1.7.9.5