View Single Post
Unread 05-12-11, 12:31 PM   #3
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 566
This time Blizzard wasn't so lazy and properly updated the TOC on the PTRs to 40200 which is less of a hassle
I'm interested in the solutions for forwards compatibility, and I want to share some myself
  • Quoting the forwards compatible fix of Omegal:
    Code:
    -- fix for 4.2 which introduces some new argument
    -- this is a temporary work-around which just drops the new argument for a quick and easy fix that is compatible with 4.2
    if tonumber((select(4, GetBuildInfo()))) >= 40200 then
    	local oldHandler = mod.COMBAT_LOG_EVENT_UNFILTERED
    	function mod:COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, mysteryArgument, destGUID, destName, destFlags, anotherMysteryArgument, ...)
    		return oldHandler(self, timestamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, ...)
    	end
    end
  • Here is my own (Ace3) fowards compatible fix:
    Lua Code:
    1. local toc = select(4, GetBuildInfo())
    2.  
    3. function MyAddOn:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
    4.     local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags
    5.     local spellID, spellName, spellSchool
    6.     local SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9
    7.  
    8.     local suffixPos
    9.     if toc >= 40200 then
    10.         timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
    11.         suffixPos = 12
    12.     else
    13.         timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = ...
    14.         suffixPos = 10
    15.     end
    16.  
    17.     local prefix = strsub(subevent, 1, 5)
    18.     if prefix == "SWING" then
    19.         SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9 = select(suffixPos, ...)
    20.     elseif prefix == "SPELL" or prefix == "RANGE" then
    21.         spellID, spellName, spellSchool, SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9 = select(suffixPos, ...)
    22.     end
    23.  
    24.     -- do stuff
    25. end
I've also seen some addons use a "tail call" solution for patch 4.1.0,
but I'm not sure how it would be done now for patch 4.2.0

Edit:
Myself I still don't really understand the mod stuff/solution though, but somehow it looks like a way better solution .. (><)

Last edited by Ketho : 05-12-11 at 12:48 PM.
Ketho is offline   Reply With Quote