Fix Alliance on-load bug, hopefully
Joseph Collins [02-08-13 - 09:46]
Fix Alliance on-load bug, hopefully
diff --git a/Currencies.lua b/Currencies.lua
index 35a9ee1..e35529c 100644
--- a/Currencies.lua
+++ b/Currencies.lua
@@ -457,6 +457,11 @@ local function SetContentColumn(index, currencyName, characterOrder, hordeDB, al
ChillEffectCurrencyFrame.rows[j].columns[index]:Show()
end
+ -- Use next(DB) to see if the DB has any entries.
+ local hasAlliance = allianceDB and (next(allianceDB) ~= nil)
+ local hasHorde = hordeDB and (next(hordeDB) ~= nil)
+ local numFactions = (hasHorde and 1 or 0) + (hasAlliance and 1 or 0)
+
-- Display the quantities for each cell in the column and keep running totals for both factions
local row = 1
local character, count
@@ -467,18 +472,15 @@ local function SetContentColumn(index, currencyName, characterOrder, hordeDB, al
SetCurrencyColumnText(ChillEffectCurrencyFrame.rows[row].columns[index], currencyName, currencyWidth, count)
- if hordeDB[v[1]] then
+ if hasHorde and hordeDB[v[1]] then
hordeTotal = hordeTotal + count
- elseif allianceDB[v[1]] then
+ elseif hasAlliance and allianceDB[v[1]] then
allianceTotal = allianceTotal + count
end
row = row + 1
end
- -- Use next(DB) to see if the DB has any entries.
- local hasAlliance = allianceDB and (next(allianceDB) ~= nil)
- local hasHorde = hordeDB and (next(hordeDB) ~= nil)
- local numFactions = (hasHorde and 1 or 0) + (hasAlliance and 1 or 0)
+
if numFactions == 1 then
if hasAlliance then
@@ -566,6 +568,8 @@ function Currencies:RedrawCurrencyFrame()
hasAlliance = self.db.sv.factionrealm["Alliance - ".. realmName] and true or false
numFactions = (hasHorde and 1 or 0) + (hasAlliance and 1 or 0)
+ if numFactions == 0 then return end
+
--== Let's figure out the column sorting. Pull everyone into a set of {charName, charData, sortTypeValue} tables, sort those, and use the resulting order
local character, count
local characterOrder = {}
@@ -645,7 +649,7 @@ function Currencies:RedrawCurrencyFrame()
else
numCurrencyColumns = NUM_MAX_CURRENCY_HEADERS
end
-
+
local currentColumn
for i = 1, numCurrencyColumns do
currentColumn = i + 1
diff --git a/TheAlternative.toc b/TheAlternative.toc
index 4582e24..fc8e575 100644
--- a/TheAlternative.toc
+++ b/TheAlternative.toc
@@ -1,4 +1,4 @@
-## Interface: 50001
+## Interface: 50100
## Title: The Alternative
## Author: Corv
## Notes: Tracks currencies and inventories across characters.