Struct....Is array?

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Well...
A straight question -

I had heard some people says that struct has 8191 instance...or array, or something like that...

What is it means?
We can only use 8191 struct in a map?
We can have 8191 members in a struct?
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Basically it means you may not have over 8191 undestroyed structs of the same type in your map, or you'll hit the limit. Also check this thread for seeing how arrays inside a struct effect it.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Just because that thread is such a messy....so that i opened up another thread around..

>>8191 undestroyed structs of the same type in your map
What is it means?
We can only use 8191 struct in a map?
We can have 8191 members in a struct?
 
Reaction score
456
It means that there cannot be 8192? undestroyed structures of same type.. or something like that, not the best helper in struct problems :p
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Destroy them and you should be fine. Essentially "leaking" structs would continue to allocate indexes such that you would reach the limit, but I don't see how it would be feasible to do so without having a major coding error.
 

SFilip

Gone but not forgotten
Reaction score
634

Daelin

Kelani Mage
Reaction score
172
I have never worked with structures, as I have never used any custom JASS developed by Vexorian or anyone else (except of course the storing systems which do not use custom natives or concepts). Destruction clearly means that a structure has to be some sort of object (quite tricky way to insert structures into JASS, considering that in C they were just practically a user-defined data type - and later in C++ they became the watermark for classes ).

To put the problem in a simple way, imagine that if you had more than you cannot have more than 8191 units on the map. This is quite simple to actually put in mind, and imagine, considering that you can actually see the units on the map. Now, replace the word 'unit' with the word 'structure'. It's like you cannot have more than 8191 such objects. How can you get rid of an object? By destroying it. Hope this helped...

-Mihai
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
I have never worked with structures, as I have never used any custom JASS developed by Vexorian or anyone else (except of course the storing systems which do not use custom natives or concepts). Destruction clearly means that a structure has to be some sort of object (quite tricky way to insert structures into JASS, considering that in C they were just practically a user-defined data type - and later in C++ they became the watermark for classes ).

To put the problem in a simple way, imagine that if you had more than you cannot have more than 8191 units on the map. This is quite simple to actually put in mind, and imagine, considering that you can actually see the units on the map. Now, replace the word 'unit' with the word 'structure'. It's like you cannot have more than 8191 such objects. How can you get rid of an object? By destroying it. Hope this helped...

-Mihai

[/Off Topic]Rofl. I wouldn't care if I had 8,191 "such" objects, I wouldn't destroy it, I would sell it. :p [/Off Topic]
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
It is quite not possible for a map to hold 8k objects...though, 1k would also hard to be reach too...
 

SFilip

Gone but not forgotten
Reaction score
634
Putting a unit on the map adds to the script. Creating a region adds to the script. A lot of other stuff add to the script.
Even if you don't use much Jass you can still reach a rather high number of handles.
 

darkbeer

Beer is Good!
Reaction score
84
I think this limit is because structs are somehow based on integers,m though i dont understand how, but integers have a limit as well^^
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Structs are just an easy-to-use interface for global arrays. Array indexes cannot go past 8191, thus you cannot have more than 8191 of any given struct in existence at any given time.

Look at the compiled code for a spell that uses structs and you'll see what I mean.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>Look at the compiled code for a spell that uses structs and you'll see what I mean.

Pretty hard to find 1
 

Vexorian

Why no custom sig?
Reaction score
187
I don't think I have ever seen a map with 8000+ living handles.

JASS:

struct axa
    integer a
    integer b
endstruct

struct bxb
    integer a
    integer b
endstruct


two different structs, you can have up to 8191 instances of EACH of them, so you can have 8000+ axas and 8000+ bxbs

But what if you use array members?

JASS:

struct axa
    integer array a[100]
    integer array b[30]
endstruct

struct bxb
    integer array a [80]
    integer array b [15]
endstruct


You can have up to 80 instances of axa and 100 instances of bxb...
 

SerraAvenger

Cuz I can
Reaction score
234
Destruction clearly means that a structure has to be some sort of object (quite tricky way to insert structures into JASS, considering that in C they were just practically a user-defined data type - and later in C++ they became the watermark for classes ).
-Mihai

here they seem more like classes in an object orientated programming language
Still wondering how to define class functions - I'll gonna read more about these structs^^

EDIT: okay I had a look into vexorian's explanation
it's actually pretty cool
and enables me to do a lot of things I was unable to do ( or thought so, at least )
Ty vm!
hell, that's just awesome - it makes everything easier for me : )
Should have started using your JassPack NewGen earlier :banghead:
Ty again
Greetings Davey Jones
 
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