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

[JASS] allocate in a filter func

Status
Not open for further replies.
Level 11
Joined
Apr 6, 2008
Messages
760
can u allocate a struct in like a filter func for e.g

JASS:
private struct Data

    static method create takes nothing returns Data //can i remove the return somehow?
        local Data d = Data.allocate()
        local group g = CreateGroup()

        call GroupEnumUnitsInRange(g,x,y,aoe,Filter(function Data.filt))
        //something
        return d
    endmethod

    static method filt takes nothing returns boolean
        local Data d = Data.allocate() //will this get the correct struct?
        //stuff
    endmethod
endstruct
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
No, this would create a new struct ;)
in filters it would be easy - use a global integer variables:
set ti=d
right before the call group....
and than in the "filt" use
local data d=ti
And to be sure it is MUI, at the end of the "filt", use:
set ti=d
That would take care if you have a wait in "filt". If you do not, it is not necessary.
P.s. What happened with your other problem - this
I never found time to examine it
 
Status
Not open for further replies.
Top