Quantcast

Relocated the local queue variable.

pschifferer [03-27-09 - 04:47]
Relocated the local queue variable.
Added a check for updating the queue to only occur when the window is open (because you can't craft stuff when it's not, so there's no reason to adjust the queue).
Filename
CauldronMain.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index 1608412..3e7c667 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -371,6 +371,8 @@ function Cauldron:OnBagUpdate(event, bagid)
         return;
     end

+	local queue = self.db.realm.userdata[self.vars.playername].queue;
+
 	-- check if the item acquired is in the intermediate list or shopping list
 	local items = Cauldron:GetItemDeltas(bagid);
 	local recalc = false;
@@ -384,8 +386,6 @@ function Cauldron:OnBagUpdate(event, bagid)
 			self:debug("OnBagUpdate: adjust shopping list");
 			--@end-alpha@
 			CauldronShopping:RemoveFromList(self.db.realm.shopping, self.vars.playername, item, itemCount);
-
-			local queue = self.db.realm.userdata[self.vars.playername].queue;

 			-- adjust intermediate list
 			self:debug("OnBagUpdate: adjust intermediate list");
@@ -396,10 +396,12 @@ function Cauldron:OnBagUpdate(event, bagid)
 				recalc = true;
 			end

-			-- adjust queue
-			if self.makingItem == item then
-				self:debug("OnBagUpdate: adjust queue for item: "..self.makingItem);
-				CauldronQueue:AdjustItemCount(queue, item, -itemCount);
+			-- adjust queue, but only if window is open
+			if CauldronFrame:IsShown() then
+				if self.makingItem == item then
+					self:debug("OnBagUpdate: adjust queue for item: "..self.makingItem);
+					CauldronQueue:AdjustItemCount(queue, item, -itemCount);
+				end
 			end
 		end
 	end