• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] {idea} [vJass] (System) CustomAttack

Status
Not open for further replies.
Level 18
Joined
Jan 21, 2006
Messages
2,552
If you're concerned with it, then use hash-tables. I always try to avoid using them where they aren't absolutely necessary, because there are only 256 of them allowed at a time.

Inferior said:
well Auto Index is recycling the Units

I don't think that AutoIndex recycles units.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
I only provided a tool in which it would allow very easy reference to every unit's most recent damage events. In his case it was only necessary to gather the damage which is why I had an array of real variables.

Either way, it isn't necessary to use hash-tables either way unless you're planning on having more than 8191 units because you can always use some other vJass features to help you out:

JASS:
type eventDamageArray extends real array [5, 40955]

Now instead of having an array of real variables we can simply use:

JASS:
struct UnitDamage
    eventDamageArray eventDamage

    ...
endstruct

We have increased the maximum capacity of the real array such that even with an array of size 5, we can still have 8191 instances of it. Though, now hash-tables may be a little faster. It's up to you what you want to use.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Anachron said:
So what's the deal with it when its slower and has limits?

Erm. What?

The reason an array of size 5 (real array) "cannot" be added to the data-struct is because then there are 5 dedicated instances required for each struct, which reduces the amount of maximum structs of that type that you can have. By simply compressing that into a single variable (non-array) that extends an array of size 5 and given extended array parameters we can eliminate this limit, though then (because the way JassHelper processes things) the array references would probably (not sure here) be the same as hash-tables.

If you have been reading, it's not "slower and has limits". It's either slower and has no limits, or has limits and is much faster.
 
Erm. What?

The reason an array of size 5 (real array) "cannot" be added to the data-struct is because then there are 5 dedicated instances required for each struct, which reduces the amount of maximum structs of that type that you can have. By simply compressing that into a single variable (non-array) that extends an array of size 5 and given extended array parameters we can eliminate this limit, though then (because the way JassHelper processes things) the array references would probably (not sure here) be the same as hash-tables.
I know this but thanks.

If you have been reading, it's not "slower and has limits". It's either slower and has no limits, or has limits and is much faster.
Yeah, that is what I meant. I don't like the limits.
 
Status
Not open for further replies.
Top