From a72266b2e24d0e0e34c1adfb9a2858b338f3f1fd Mon Sep 17 00:00:00 2001 From: ackis Date: Fri, 27 Feb 2009 18:51:33 +0000 Subject: [PATCH] Make the code for scanning acquire types for the mini-map a bit more optimized and removed some code duplication. --- ARLFrame.lua | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/ARLFrame.lua b/ARLFrame.lua index 6e49db1..1065e62 100644 --- a/ARLFrame.lua +++ b/ARLFrame.lua @@ -344,6 +344,19 @@ do end + function addon:CheckMapDisplay(v, filters) + + local display = false + + -- If it's a vendor check to see if we're displaying it + if (v["Type"] == 2) then + display = CheckDisplayFaction(filters, vendorDB[v["ID"]]["Faction"]) + end + + return display + + end + -- Description: -- Expected result: -- Input: @@ -360,6 +373,7 @@ do local worldmap = addon.db.profile.worldmap local minimap = addon.db.profile.minimap + local filters = addon.db.profile.filters if ((worldmap == true) and (minimap == true)) then @@ -379,11 +393,7 @@ do if (singlerecipe) then -- loop through acquire methods, display each for k, v in pairs(recipeDB[singlerecipe]["Acquire"]) do - -- If it's a vendor check to see if we're displaying it - if (v["Type"] == 2) then - local display = CheckDisplayFaction(addon.db.profile.filters, vendorDB[v["ID"]]["Faction"]) - maplist[v["ID"]] = display - end + maplist[v["ID"]] = CheckMapDisplay(v,filters) end else -- Scan through all recipes to display, and add the vendors to a list to get their acquire info @@ -392,11 +402,7 @@ do if ((recipeDB[recipeIndex]["Display"] == true) and (recipeDB[recipeIndex]["Search"] == true)) then -- loop through acquire methods, display each for k, v in pairs(recipeDB[recipeIndex]["Acquire"]) do - -- If it's a vendor check to see if we're displaying it - if (v["Type"] == 2) then - local display = CheckDisplayFaction(addon.db.profile.filters, vendorDB[v["ID"]]["Faction"]) - maplist[v["ID"]] = display - end + maplist[v["ID"]] = CheckMapDisplay(v,filters) end end end -- 1.7.9.5