• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Saving diffrent handles on the same memory cell

Status
Not open for further replies.
Level 10
Joined
May 24, 2016
Messages
367
So the question is I save some effect by StringHash on Hashtable, then
Code:
call DestroyEffect(LoadEffectHandle(Hash,GetHandleId(f),StringHash("RPT_Eff")))
set eff = AddSpecialEffect....
call SaveEffectHandle(Hash,GetHandleId(f),StringHash("RPT_Eff"))
I do this, so I wonder, should I remove a memory cell in Hash before saving a new effect on it?
 
why are you using a string hash? why not use:

JASS:
call SaveEffectHandle(Hash, GetHandleId(f), 1, eff)

a handle is a pointer to a data structure, in your case the effect eff. When you call the DestroyEffect function the effect is destroyed in game and the pointer still have its value stored. When you save another effect in its position the pointer is now overwritten with the new value (it dosent mean that the effect has leaked, because you destroyed it). The important think that you need to do is to, at some point, flush the child hastable for the handle f, nullfying their values and cleaning any handle leak, like this:

JASS:
call FlushChildHashtable(Hash, GetHandleId(f))
 
Status
Not open for further replies.
Back
Top