From 7ed8e6d1b320f90f47c254c251116baba762c6ff Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Thu, 28 Mar 2013 04:34:07 +0000 Subject: [PATCH] Code cleanup. * Protect against some nil values. * Remove awkward GetSpellInfoOrNil function. * Remove unused variables in OvaleAura. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@837 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleAura.lua | 10 ---------- OvaleBestAction.lua | 4 +++- OvaleCondition.lua | 22 +++++++++++++++------- OvaleData.lua | 9 --------- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/OvaleAura.lua b/OvaleAura.lua index ecf926e..4a035cc 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -161,8 +161,6 @@ end function UpdateAuras(unitId, unitGUID) self_serial = self_serial + 1 - local damageMultiplier - if not unitId then return end @@ -173,10 +171,6 @@ function UpdateAuras(unitId, unitGUID) return end - if unitId == "player" then - damageMultiplier = 1 - end - if not self_aura[unitGUID] then self_aura[unitGUID] = {} end @@ -228,10 +222,6 @@ function UpdateAuras(unitId, unitGUID) self_aura[unitGUID] = nil end - if unitId == "player" then - self_baseDamageMultiplier = damageMultiplier - end - Ovale.refreshNeeded[unitId] = true end -- diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua index b35f659..6bb059a 100644 --- a/OvaleBestAction.lua +++ b/OvaleBestAction.lua @@ -510,6 +510,7 @@ local function ComputeOperator(element) n = x * c else Ovale:Error("at least one value must be constant when multiplying") + return nil end elseif element.operator == "+" then if c + z == 0 then @@ -546,6 +547,7 @@ local function ComputeOperator(element) n = 0 else Ovale:Error("Parameters of % must be constants") + return nil end else -- Comparisons @@ -618,7 +620,7 @@ local function ComputeOperator(element) end end - Ovale:Log("result = " .. l .. " + " .. m .. "*" .. n) + Ovale:Log("result = " .. tostring(l) .. "+(t-" .. tostring(m) .. ")*" .. tostring(n)) return startA, endA, OVALE_DEFAULT_PRIORITY, PutValue(element, l, m, n) end diff --git a/OvaleCondition.lua b/OvaleCondition.lua index dabf5cd..a987178 100644 --- a/OvaleCondition.lua +++ b/OvaleCondition.lua @@ -706,13 +706,17 @@ end -- 1: spellId -- returns: bool OvaleCondition.conditions.cancast = function(condition) - local name, rank, icon, cost, isFunnel, powerType, castTime = OvaleData:GetSpellInfoOrNil(condition[1]) - local actionCooldownStart, actionCooldownDuration, actionEnable = OvaleState:GetComputedSpellCD(condition[1]) + local spellId = condition[1] + local actionCooldownStart, actionCooldownDuration = OvaleState:GetComputedSpellCD(spellId) local startCast = actionCooldownStart + actionCooldownDuration - if startCast