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

[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