Builder Bob
Live free or don't
- Reaction score
- 249
JASS:struct Handle void* pointerToInGameObject integer referenceCounter endstruct
When ever you copy a variable it increases referenceCounter,
when you null a variable it decreases referenceCounter
when referenceCounter reaches zero Handle is automatically recycled.
The problem with gamecache and I2H is that converting a handle to integer will decrease referenceCounter and if you don't keep a reference in some global array the next time you try to retrieve that handle by using I2H you will be pointing to recycled handle instead of the original one == possible game crash
That is why array systems pwn gamecache, and that is why no pro mapper uses I2H any more.
Really great stuff! So we actually null local variables to decrease the referenceCounter so the handle can eventually be recycled.
It's much clearer for me now why the I2H functions are sketchy. I'm glad I don't use GameCache anymore. +rep for this of course.