comparison gui.lua @ 87:9fea75b0927b

If deleting a history entry results in an empty player table, remove that as well. Change g_uniques to store player's name rather than index as the history field, and indirect through the byname table.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 22 Jun 2012 00:58:59 +0000
parents 703bbe61d12d
children c9f955f9a285
comparison
equal deleted inserted replaced
86:703bbe61d12d 87:9fea75b0927b
393 --for i = (opt_starting_index or self.hist_clean or 1), #self.history do 393 --for i = (opt_starting_index or self.hist_clean or 1), #self.history do
394 local cache_okay = true 394 local cache_okay = true
395 for pi,player in ipairs(self.history) do 395 for pi,player in ipairs(self.history) do
396 local col1 = new() 396 local col1 = new()
397 col1.OLi = pi 397 col1.OLi = pi
398 col1.OLn = #player
399 col1.value = player.name -- may spiffy this up in future 398 col1.value = player.name -- may spiffy this up in future
400 399
401 for li,unique in ipairs(player.unique) do 400 for li,unique in ipairs(player.unique) do
402 local col2 = new() 401 local col2 = new()
403 col2.OLi = li 402 col2.OLi = li
1501 if e.kind ~= 'hist' then return true end 1500 if e.kind ~= 'hist' then return true end
1502 return e.OLwho == history_filter_who 1501 return e.OLwho == history_filter_who
1503 end 1502 end
1504 1503
1505 hist_dropdownfuncs = dropdownfuncs{ 1504 hist_dropdownfuncs = dropdownfuncs{
1506 ["Delete this loot event from history"] = function(rowi) 1505 ["Delete this loot event from history"] = function()--rowi
1507 local h = _d:GetUserData("DD history entry") 1506 local h = _d:GetUserData("DD history entry")
1508 local okay,err = addon:_delHistoryEntry (h.cols[2].OLu, h.itemlink) 1507 local numleft,err = addon:_delHistoryEntry (h.cols[2].OLu, h.itemlink)
1509 if okay then 1508 if numleft then
1510 addon:Print("Removed history entry %s from %s.", 1509 addon:Print("Removed history entry %s from %s.",
1511 h.itemlink, addon:colorize(h.OLwho,h.OLclass)) 1510 h.itemlink, addon:colorize(h.OLwho,h.OLclass))
1511 if numleft < 1 then
1512 history_filter_who = nil
1513 _d:GetUserData("histST"):SetFilter(history_filter_by_recent)
1514 setstatus(hist_normal_status)
1515 end
1512 else 1516 else
1513 addon:Print(err) 1517 addon:Print(err)
1514 end 1518 end
1515 end, 1519 end,
1516 1520
1517 ["Delete this player's entire loot history"] = function(rowi) 1521 ["Delete this player's entire loot history"] = function()--rowi
1518 local h = _d:GetUserData("DD history entry") 1522 local h = _d:GetUserData("DD history entry")
1519 local name = h.OLwho 1523 local name = h.OLwho
1520 local player_i = addon.history.byname[name] 1524 local player_i = addon.history.byname[name]
1521 local gone = tremove (addon.history, player_i) 1525 local gone = tremove (addon.history, player_i)
1522 assert(gone.name == name) 1526 assert(gone.name == name)