• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Question about unit handles

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
Is it possible for a unit to have two handles directly next to each other?

like, unit A has the handle ID

0xFF0AFF

unit B's handle ID is

0xFF0B00
 
Level 4
Joined
Jan 27, 2010
Messages
133
Should work if you spawn them directly after each other as early as you can in map init. TimerUtils (red) actually uses this method.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
There is something else that I don't understand, why they start with a big integers like: 1048822 ?

pleaseplzplplz learn to make your own threads.

wc3 indents all memory in-game by 0x100000 to seperate it from disposable memory to engine memory
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
As long it's done on map init without any wait involved it should be true i guess (even if you remove units before, because remove an unit is not something instant).
But if it's done after, then it could be wrong (unit or even other handle recycling)

Now if for some silly reason you really want to create 2 such units and it's done after map init, or even with some wait between the 2 unit creations, you still can use a loop and use Create/RemoveUnit as long it's necessary.
However that would be horribly inefficient, and maybe you would have even to care about limit op.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
As long it's done on map init without any wait involved it should be true i guess (even if you remove units before, because remove an unit is not something instant).
But if it's done after, then it could be wrong (unit or even other handle recycling)

Now if for some silly reason you really want to create 2 such units and it's done after map init, or even with some wait between the 2 unit creations, you still can use a loop and use Create/RemoveUnit as long it's necessary.
However that would be horribly inefficient, and maybe you would have even to care about limit op.

well it was for hashtable saving, but im just ending up indenting the key
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
handle id has nothing to do with where in system the handle points to, its counter and god knows why blizzard decided to count from 0x10000
if it was directly connected to the pointer position you would never have 2 handles closer than 4 integers to each other, its simple indexing, something on style of struct allocation but with intial value 0x10000
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
handle id has nothing to do with where in system the handle points to, its counter and god knows why blizzard decided to count from 0x10000
if it was directly connected to the pointer position you would never have 2 handles closer than 4 integers to each other, its simple indexing, something on style of struct allocation but with intial value 0x10000

as i said, 0x0... memory is used for game engine and shouldn't be terminated where 0x1... memory is used in map and lobby specific data and is often terminated and reconstructed.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
then why can I make texttag with handle id 0?
and basically why texttags have id of 100 or less?
again, handle has nothing to do with actual memory, its simple counter with linked list, the very same principe struct allocation uses
if it was actual memory, it would be impossible to have 2 handles having difference in handle id of 1 because unit is maybe even 100 bytes big class all things considered, so you would have 0x100000 and next handle would be 0x100100 maybe
anyways your question was answered, if you create the units immedietally after each other, their handles should be next to each other
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
then why can I make texttag with handle id 0?
and basically why texttags have id of 100 or less?
again, handle has nothing to do with actual memory, its simple counter with linked list, the very same principe struct allocation uses
if it was actual memory, it would be impossible to have 2 handles having difference in handle id of 1 because unit is maybe even 100 bytes big class all things considered, so you would have 0x100000 and next handle would be 0x100100 maybe
anyways your question was answered, if you create the units immedietally after each other, their handles should be next to each other

sshshshsh.

GetHandleId() when being used on texttags does not return the actual handle id of the text tag but rather the counter of the texttag handle extension because they are not widgets
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Special event is not widget too and it has normal handle id, hence the name HandleId not WidgetId

nope. the handles are handled (lol) by a text tag handling system (made up the name) and each text tag is registered into the system and only the system knows what the handle id is so thus it doesnt know what to return so it just returns its system id

I don't know if it's relevant, but it seems that all the handles that extend agent have those high number IDs, while the text tags, lightnings and images, which each have it's own stack, only extend handle.

well yeah because an agent is its own handle tracker
 
Status
Not open for further replies.
Top