Improve support for naming both swap items

This commit is contained in:
Kyle Coburn 2015-04-13 00:49:25 -07:00
parent eec7438d82
commit 1a57bbf402
1 changed files with 9 additions and 1 deletions

View File

@ -675,10 +675,18 @@ Strategies.functions = {
end
local itemIndex = Inventory.indexOf(data.item)
local destIndex = data.dest
local hasSwappedItems
if type(destIndex) == "string" then
destIndex = Inventory.indexOf(destIndex)
if destIndex < 0 then
p("Not available to swap", data.item, data.dest)
return true
end
hasSwappedItems = itemIndex < destIndex
else
hasSwappedItems = itemIndex == destIndex
end
if itemIndex == destIndex then
if hasSwappedItems then
if Strategies.closeMenuFor(data) then
return true
end