Questions on Offsets

Dirac

22710180
Reaction score
147
Is [ljass]OFFSET=0x100000[/ljass] unsafe to use inside an array index for handles? why? is there any way to fix that other than using hashtables?
 

Nestharus

o-o
Reaction score
84
He means to use in an array.


If you have over 8191 handles (all handles), your array will go boom.



For units and items, you can use indexing. For timers, you can either use a hashtable or T32 or one of the many timer tools I wrote. For most other handles it's going to be a hashtable lookup.
 

tooltiperror

Super Moderator
Reaction score
231
Do widgets have their own separate pool for Handle Ids? What makes them special and safe to use Offsets with?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Do widgets have their own separate pool for Handle Ids? What makes them special and safe to use Offsets with?

I think by indexing he meant resources like AIDS, which use the custom value. You shouldn't use an offset with these unless you've got some sort of failsafe that lets even a removed item/unit get de-indexed.

It's safe to use the Offset for most other handles, (including timers, though timer systems makes the idea illogical), as any removal of these handles is done in the code (and it's therefore theoretically possible to de-index every destroyed handle). However, it's still not recommended, because as Nestharus mentioned, > 8191 handles means that handles can have an index outside this range. There's some stability reasons as well, but I'm not 100% sure about the origin of those issues. Hashtables just make it much simpler, and the speed difference is not large.
 

Jedi

New Member
Reaction score
63
You still can use offsets in your own map depends on your handle count, or you can add a constant boolean to your system

JASS:
//set this to true if your map don't have over xxxx handles
private constant boolean USE_HANDLE_ID_OFFSET = true
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top