Quantcast

fixed UseQuestLogSpecialItem() taint

Alex Shubert [10-25-14 - 13:12]
fixed UseQuestLogSpecialItem() taint
Filename
QuestLevel.lua
ui/main_options.lua
diff --git a/QuestLevel.lua b/QuestLevel.lua
index 4a990e0..84284dd 100644
--- a/QuestLevel.lua
+++ b/QuestLevel.lua
@@ -60,7 +60,7 @@ function AutoTurnIn:ShowQuestLevelInWatchFrame()
 				local tagString = AutoTurnIn.QuestTypesIndex[questTypeIndex] or ""
 				local dailyMod = (frequency == LE_QUEST_FREQUENCY_DAILY or frequency == LE_QUEST_FREQUENCY_WEEKLY) and "\*" or ""

-				-- resizing the block if new line requires more spaces.
+				--resizing the block if new line requires more spaces.
 				local h = block.height - block.HeaderText:GetHeight()
 				block.HeaderText:SetText(AutoTurnIn.WatchFrameLevelFormat:format(level, tagString, dailyMod, title))
 				block.height = h + block.HeaderText:GetHeight()
diff --git a/ui/main_options.lua b/ui/main_options.lua
index 2100e35..885952b 100644
--- a/ui/main_options.lua
+++ b/ui/main_options.lua
@@ -156,8 +156,33 @@ OptionsPanel.okay = function()
 	AutoTurnInCharacterDB = CopyTable(ptable.TempConfig)
 	AutoTurnIn:SetEnabled(AutoTurnInCharacterDB.enabled)

+	--[[
+	-- any of the calls below taints the UseQuestLogSpecialItem. Expand-collapse is a workaround
 	securecall(ObjectiveTracker_Update, OBJECTIVE_TRACKER_UPDATE_ALL)
 	QuestMapFrame_UpdateAll()
+
+	-- this one happens too fast and "onUpdate' event does not occur. The custome frame with delay and 'OnUpdate' event can help.
+	if (ObjectiveTrackerFrame.collapsed == nil) then
+		ObjectiveTracker_Collapse();
+		ObjectiveTracker_Expand();
+	end
+	]]--
+	-- and here goes the dirty hack!!! No direct update calls, hence, no global variable taints!!!
+	if GetNumQuestWatches() > 0 then
+		local inLog = GetQuestIndexForWatch(1);
+		if IsQuestWatched(inLog) then
+			RemoveQuestWatch (inLog);
+			AddQuestWatch(inLog);
+		else
+			AddQuestWatch(inLog);
+			RemoveQuestWatch (inLog);
+		end
+	else
+		if  (GetNumQuestLogEntries() > 0) then
+			AddQuestWatch(2);
+			RemoveQuestWatch (2);
+		end
+	end
 end

 InterfaceOptions_AddCategory(OptionsPanel)
\ No newline at end of file