HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A array problem.

05-28-2009, 07:23 AM#1
wraithseeker
Right now I have a global that has a size of 8191 for all recipe types in my recipe system. It works well and such but I thought of improving it to have a global for each recipe type but it would break my MUI structs.

Does anybody has a clue on how to do that?
05-28-2009, 08:36 AM#2
Pyrogasm
It took me a while to figure out, but he's saying he has this:
Collapse JASS:
globals
    boolean array Combined
endglobals

struct Recipe
    //...
endstruct
And he wants to do this:
Collapse JASS:
globals
endglobals

struct Recipe
    boolean array Combined[8191]
endstruct
But that lowers the maximum instances of Recipe to 1.

The only way I can think of doing it easily is this:
Collapse JASS:
struct Recipe
    Table CombinedT

    method operator Combined takes integer J returns boolean
        return CombinedT[J] == 1
    endmethod

    method operator Combined= takes integer J, boolean V returns nothing
        if V then
            set CombinedT[J] = 1
        endif
        set CombinedT[J] = 0
    endmethod

    static method create takes nothing returns nothing
        set CombinedT = Table.create()
    endmethod
endstruct
05-28-2009, 01:01 PM#3
Alevice
how about an static array?
05-28-2009, 01:58 PM#4
Vexorian
Quote:
have a global for each recipe type
what? why?
05-28-2009, 02:12 PM#5
wraithseeker
Got this solved thanks to pyrogasm.