Fix bug in r1206 in the way that slot <--> action mappings are managed.
Johnny C. Lam [04-21-14 - 05:01]
Fix bug in r1206 in the way that slot <--> action mappings are managed.
The spell/item/macro to slot ID mapping wasn't correctly being added due
to an improper condition. Now add the mapping if it either doesn't
already exist or if the new slot ID is lower than the existing one (in the
case where a spell is present multiple times on the action bar).
This fixes the return values of the :GetForSpell(), :GetForMacro(), and
:GetForIem() methods to return something other than nil.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1298 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/OvaleActionBar.lua b/OvaleActionBar.lua
index 882bc04..8dfbedc 100644
--- a/OvaleActionBar.lua
+++ b/OvaleActionBar.lua
@@ -1,7 +1,7 @@
--[[--------------------------------------------------------------------
Ovale Spell Priority
Copyright (C) 2012 Sidoine
- Copyright (C) 2012, 2013 Johnny C. Lam
+ Copyright (C) 2012, 2013, 2014 Johnny C. Lam
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License in the LICENSE
@@ -125,7 +125,7 @@ function OvaleActionBar:UpdateActionSlot(slot)
if actionType == "spell" then
id = tonumber(id)
if id then
- if self.spell[id] and slot < self.spell[id] then
+ if not self.spell[id] or slot < self.spell[id] then
self.spell[id] = slot
end
self.action[slot] = id
@@ -133,7 +133,7 @@ function OvaleActionBar:UpdateActionSlot(slot)
elseif actionType == "item" then
id = tonumber(id)
if id then
- if self.item[id] and slot < self.item[id] then
+ if not self.item[id] or slot < self.item[id] then
self.item[id] = slot
end
self.action[slot] = id
@@ -141,7 +141,7 @@ function OvaleActionBar:UpdateActionSlot(slot)
elseif actionType == "macro" then
local actionText = API_GetActionText(slot)
if actionText then
- if self.macro[actionText] and slot < self.macro[actionText] then
+ if not self.macro[actionText] or slot < self.macro[actionText] then
self.macro[actionText] = slot
end
self.action[slot] = actionText