refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-07-31 12:16:39 +02:00
parent ee30422cd5
commit af15a2defa
3 changed files with 8 additions and 30 deletions
+2 -8
View File
@@ -63,12 +63,6 @@ function private.test(record)
end
end
function private.record_remover(record)
return function()
m.listing:RemoveAuctionRecord(record)
end
end
do
local scan_id = 0
local IDLE, SEARCHING, FOUND = {}, {}, {}
@@ -90,7 +84,7 @@ do
end,
function()
state = IDLE
m.record_remover(record)()
m.listing:RemoveAuctionRecord(record)
end,
function(index)
state = FOUND
@@ -98,7 +92,7 @@ do
m.cancel_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then
Aux.cancel_auction(index, m.record_remover(record))
Aux.cancel_auction(index, Aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.cancel_button:Enable()
+3 -9
View File
@@ -63,12 +63,6 @@ function private.test(record)
end
end
function private.record_remover(record)
return function()
m.listing:RemoveAuctionRecord(record)
end
end
do
local scan_id = 0
local IDLE, SEARCHING, FOUND = {}, {}, {}
@@ -90,7 +84,7 @@ do
end,
function()
state = IDLE
m.record_remover(record)()
m.listing:RemoveAuctionRecord(record)
end,
function(index)
state = FOUND
@@ -102,7 +96,7 @@ do
Aux.place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
Aux.info.bid_update(record)
m.listing:SetDatabase()
end or m.record_remover(record))
end or Aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.bid_button:Enable()
@@ -111,7 +105,7 @@ do
if record.buyout_price > 0 then
m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then
Aux.place_bid('bidder', index, record.buyout_price, m.record_remover(record))
Aux.place_bid('bidder', index, record.buyout_price, Aux.f(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.buyout_button:Enable()
+3 -13
View File
@@ -499,16 +499,6 @@ function private.test(record)
end
end
function private.record_remover(table, record)
return function()
table:RemoveAuctionRecord(record)
end
end
function private.record_bid_updater(record)
return
end
do
local scan_id = 0
local IDLE, SEARCHING, FOUND = {}, {}, {}
@@ -532,7 +522,7 @@ do
end,
function()
state = IDLE
m.record_remover(search.table, record)()
search.table:RemoveAuctionRecord(record)
end,
function(index)
if Aux.safe(search.table:GetSelection()).record/nil ~= record then
@@ -548,7 +538,7 @@ do
Aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
Aux.info.bid_update(record)
search.table:SetDatabase()
end or m.record_remover(search.table, record))
end or Aux.f(search.table.RemoveAuctionRecord, search.table, record))
end
end)
m.bid_button:Enable()
@@ -557,7 +547,7 @@ do
if record.buyout_price > 0 then
m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and search.table:ContainsRecord(record) then
Aux.place_bid('list', index, record.buyout_price, m.record_remover(search.table, record))
Aux.place_bid('list', index, record.buyout_price, Aux.f(search.table.RemoveAuctionRecord, search.table, record))
end
end)
m.buyout_button:Enable()