Does this leak?

s3rius

Linux is only free if your time is worthless.
Reaction score
130
I've copied something from Blizzard's Bomber Command and modified it for my needs. Now I'd like to ask if there are any leaks remaining (since I have no experience in removing trigger leaks)

JASS:
function Rocket_Impact takes nothing returns nothing
    local unit u= GetTriggerUnit()
    
    call DestroyTrigger( GetTriggeringTrigger() )
    
    //Do something
    //Do something more
    
    call RemoveUnit(u)
    call RemoveUnit(GetEventDamageSource())
    set u = null
endfunction

function Fire_Rocket takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local unit u
    local unit targ
    local location targloc = GetSpellTargetLoc()
    local trigger trg
    
    set u=CreateUnitAtLoc(GetOwningPlayer(c),'n009', GetUnitLoc(c),GetUnitFacing(c))
    set targ = CreateUnitAtLoc(GetOwningPlayer(c), 'n00B', targloc, 270)
    
    //Do some other shit
  
    set trg = CreateTrigger()
    call TriggerRegisterUnitEvent( trg, targ, EVENT_UNIT_DAMAGED )
    call TriggerAddAction( trg, function Rocket_Impact )

    call IssueTargetOrder( u, "thunderbolt", targ )
    
    set c = null
    set targ = null
    set u=null
    call RemoveLocation(targloc)
    set targloc = null
    set trg = null
endfunction


Thanks for any help.
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
Thanks, I thought it might leak that trigger action. I guess I managed to clean it up. And I overlooked that GetUnitLoc :x +rep
 

AceLegend90

New Member
Reaction score
6
I don't se any more leaks after you fix the trigger action, but you could optimize.

Using X and Y coordinates instead of a location would optimize the code better since you don't need to remove or null reals.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top