Populate initial data for all characters.

Matthew Pavlinsky [06-15-15 - 14:55]
Populate initial data for all characters.
Filename
AIResearchGrid.lua
diff --git a/AIResearchGrid.lua b/AIResearchGrid.lua
index 323c14a..36574e8 100644
--- a/AIResearchGrid.lua
+++ b/AIResearchGrid.lua
@@ -517,21 +517,26 @@ end -- AIRG.PopulateMatrix

 -- Lookup the style data for the current character and send it to saved vars.
 function AIRG.PopulateStyleData()
-    AIRG.vars.styles[AIRG.playerName] = {}    -- create a table for this character's matrix
-    local i, j, known
-    for i = 1, 14 do
+  for thisname, _ in pairs(AIRG.vars.data) do   --iterate over all characters
+    if thisname ~= AIRG.all then                --skip our virtual
+
+      AIRG.vars.styles[thisname] = {}    -- create a table for this character's matrix
+      local i, j, known
+      for i = 1, 14 do
         j = AIRG.styleLookupItem[i]
         known = IsSmithingStyleKnown(j, 1) --patternIndex set to 1, temporary workaround for changes introduced in Update 4
-        AIRG.vars.styles[AIRG.playerName][i] = known
-    end
-	--Dwemer style chapters
-    AIRG.vars.styles[AIRG.playerName][15] = {}
-    local itemStyle = AIRG.styleLookupItem[15]
-    for i = 1, 14 do
+        AIRG.vars.styles[thisname][i] = known
+      end
+      --Dwemer style chapters
+      AIRG.vars.styles[thisname][15] = {}
+      local itemStyle = AIRG.styleLookupItem[15]
+      for i = 1, 14 do
         --local known = IsSmithingStyleKnown(itemStyle, i)
         local _, numCompleted = GetAchievementCriterion(1144, i)
-        AIRG.vars.styles[AIRG.playerName][15][AIRG.styleChaptersLookup[i]] = numCompleted == 1
+        AIRG.vars.styles[thisname][15][AIRG.styleChaptersLookup[i]] = numCompleted == 1
+      end
     end
+  end
 end -- AIRG.PopulateStyleData

 -- When any character data changes we have to go through and create our virtual "All" from the beginning.