• 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.

Unit Ids and Handle Ids

Status
Not open for further replies.
If I have a hashtable (udg_Hash), and I store entries in it that are indexed by GetHandleId and other entries that are indexed by GetUnitTypeId will a collision occur, or is the range of handle ids different from the range of type ids? If they are different than I can store data about several unit types, as well as instance data for those units.
 
Handle ID's for objects on the regular handle stack will range from 0x100000 (which is the equivalent of 1048576) to infinity (depending on how many objects you have). If you have 3 objects, theoretically the last object would occupy 1048578 as a handle ID.

There are, however, some objects that have handle ID's that are not on the normal handle stack. For example, texttags or lightning. They will have indexes that range from 0-99 (I don't remember if they count backwards or what).

However, in most practical cases you won't experience any collisions. You just have to be careful when saving more obscure types such as texttags/lightning/weathereffects. Those may overlap with each other.

As for handle ID <-> rawcode ID collisions, you shouldn't experience problems.
 
Status
Not open for further replies.
Top