• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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