HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

H2I return bug Integer value question

12-22-2007, 09:30 AM#1
chobibo
Hello, I just want to ask about the H2I return bug integer return, is the value always in this value range 1048600 - 1048800. What exactly does the return value return, a memory address or something else. Thanks and sorry if the question is a bit vague, I really can't understand it either.

EDIT:
I tried using a trigger to determine the return values on different maps and I found out that for every map the return values were different.

Collapse JASS:
scope Test

globals
    public trigger trig = CreateTrigger()
endglobals

private function H2I takes handle h returns integer
    return h
    return 0
endfunction

private function Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local integer i =  H2I(t)
    call BJDebugMsg(I2S(H2I(t)))
    call BJDebugMsg(I2S(i))
    
    call TriggerSleepAction(1.00)
    call DestroyTimer(t)
    set t = null
endfunction

public function InitTrig takes nothing returns nothing
    call TriggerRegisterTimerEventPeriodic( trig, 0.50 )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope
12-22-2007, 10:39 AM#2
Captain Griffen
There is no upper bound. It returns the index for the handle, as used by WC3's internal systems. These indexes are given out in order, and are reused only after all references to them are removed (there is a bug whereby non-nulled local variables may leave the reference count higher than it should be, and if you double destroy an object it can screw it up the other way).
12-22-2007, 12:29 PM#3
rain9441
Not all handle indexes start at 0x100000 though. I know for a fact that weather effects start at 0 (first weather effect you create always is 0 == null)
12-22-2007, 01:11 PM#4
Vexorian
It's nice to see you are taking so much time and effort to reinvent the wheel.

Take a look to this : http://hilton.vs.oiccam.com/showthread.php?t=98268

You actually posted there...

CSData does what you are doing only that it does it simpler, the first handle index is 0x100000, then there are data system and HSAS that are initially as fast as CSData then they become faster than CSData and finally they screw up instead of CSData.