• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Damage Text, Leakage?

Status
Not open for further replies.
Level 4
Joined
Jun 8, 2007
Messages
89
I was simply wondering if this function leaks/if there is a better way to do this (the part I'm wondering about is the floating text).
Any help would be greatly appreciated.

JASS:
function damageUnit takes unit attacker, unit target, integer damage, attacktype atype, integer dtype, boolean considerArmor, integer splDmgCoeff returns nothing
        // find real damage
    set damage = R2I(damage + udg_spellDamage[GetPlayerId(GetOwningPlayer(attacker))] * splDmgCoeff)
    
        // deal the damage
    call UnitDamageTargetEx(attacker, target, damage, atype, dtype, considerArmor)
        
        // show dmg to attacker
    call CreateTextTagUnitBJ(I2S(damage), attacker, 0, 10, 0.00, 0.00, 100.00, 0)
    call SetTextTagVelocity(bj_lastCreatedTextTag, 100, 0)
    call ShowTextTagForceBJ(false, bj_lastCreatedTextTag, bj_FORCE_ALL_PLAYERS)
    call ShowTextTagForceBJ(true, bj_lastCreatedTextTag, GetForceOfPlayer(GetOwningPlayer(attacker)))
    call SetTextTagPermanent(bj_lastCreatedTextTag, false)
    call SetTextTagFadepoint(bj_lastCreatedTextTag, 0.50)
    call SetTextTagLifespan(bj_lastCreatedTextTag, .75)

        // show dmg to target
    call CreateTextTagUnitBJ(I2S(damage), target, 0, 10, 0.00, 0.00, 100.00, 0)
    call SetTextTagVelocity(bj_lastCreatedTextTag, 100, 0)
    call ShowTextTagForceBJ(false, bj_lastCreatedTextTag, bj_FORCE_ALL_PLAYERS)
    call ShowTextTagForceBJ(true, bj_lastCreatedTextTag, GetForceOfPlayer(GetOwningPlayer(target)))
    call SetTextTagPermanent(bj_lastCreatedTextTag, false)
    call SetTextTagFadepoint(bj_lastCreatedTextTag, 0.50)
    call SetTextTagLifespan(bj_lastCreatedTextTag, .75)
endfunction

-Thanks
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Just like you do not need to null timer locals if you use timer recycling. Still does not mean that I will not null them unless I need something for optimum efficency as it is a good practice for people to understand the code from and to be safe as far as leaks go.
 
Status
Not open for further replies.
Top