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

[vJASS] Whats wrong with this

Status
Not open for further replies.
Level 16
Joined
Mar 3, 2006
Messages
1,564
This is from a tutorial made by Nestharus (here)
JASS:
struct MyStruct extends array
    private static integer instanceCount = 0
    private static thistype recycle = 0
    private thistype recycleNext

    static method create takes nothing returns thistype
        local thistype this

        //first check to see if there are any structs waiting to be recycled
        if (recycle == 0) then
            //if recycle is 0, there are no structs, so increase instance count
            set instanceCount = instanceCount + 1
            set this = instanceCount
        else
            //a struct is waiting to be recycled, so use it
            set this = recycle
            set recycle = recycle.recycleNext
        endif

        //perform creation code

        return this
    endmethod

    method destroy takes nothing returns nothing
        //add to recycle stack
        set recycleNext = recycle
        set recycle = this
    endmethod
endstruct
it gives me error like this:

"Member redeclared : destroy"

and I don't know why it is not working, any help ?
 
Status
Not open for further replies.
Top