View Single Post
Old 08-07-2008, 05:40 PM   #27
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Really minor suggestions :

Collapse JASS:
    function NewTimer takes nothing returns timer
        if (tN==0) then
            return CreateTimer() // yeah, we win a set :p
        else
            set tN=tN-1
        endif
        call SetTimerData(tT[tN],0)
     return tT[tN]
    endfunction

    //==========================================================================================
    function ReleaseTimer takes timer t returns nothing
        if(t==null) then
            debug call BJDebugMsg("Warning: attempt to release a null timer")
            return
        endif
        if (tN==8191) then
            debug call BJDebugMsg("Warning: Timer stack is full, destroying timer!!")

            //stack is full, the map already has much more troubles than the chance of bug
            call DestroyTimer(t)
        else
            if(GetTimerData(t)==HELD) then
                debug call BJDebugMsg("Warning: ReleaseTimer: Double free!")
                return
            endif
            call PauseTimer(t) // if the timer is already released, then we don't need to pause it again.
            call SetTimerData(t,HELD)
            set tT[tN]=t
            set tN=tN+1
        endif    
    endfunction

I love the simplicity of this library, i will use it for dummies units and group as well, gj.
__________________
Cool != Useful
Troll-Brain is offline   Reply With Quote