• 🏆 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] 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