From 7f8872c1dcac4cfec9b0f83c9dbdf970b96b7ca7 Mon Sep 17 00:00:00 2001 From: Alex Shubert Date: Sat, 25 Oct 2014 17:12:36 +0400 Subject: [PATCH] fixed UseQuestLogSpecialItem() taint --- QuestLevel.lua | 2 +- ui/main_options.lua | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) 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 -- 1.7.9.5