• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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,198
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