- Joined
- Jan 1, 2010
- Messages
- 197
- This requires vJASS (go figure)
- You require W.E. with vJASS injector code to use this system (like This one)
Q: is it magic?
A: No.....
Q: Is it real?
A: yes.
Q: how does it worx?
A: its a very fancy linked list
Q: Is it syntactically clean?
A: sorta
[jass=genericList]
//genericList template class
//written by UnholyDecimator
// 12/6/15
//! textmacro genList takes listType, getterName, structName
struct $structName$
$listType$ cur
thistype next
public static method create takes $listType$ r returns thistype
local thistype new
set new = .allocate()
set new.cur = r
set new.next = 0
return new
endmethod
public method get$getterName$ takes nothing returns $listType$
return cur
endmethod
public method isChild takes nothing returns boolean
if (next == 0) then
return false
endif
return true
endmethod
public method attachChild takes $listType$ r returns nothing
set next = thistype.create(r)
endmethod
public method getChild takes nothing returns thistype
if (isChild()) then
return next
endif
return 0
endmethod
public method destroy takes nothing returns nothing
if(isChild()) then
call next.destroy()
endif
set cur = null
set next = 0
call .deallocate()
endmethod
endstruct
//! endtextmacro
[/code]
[jass=raceList]
//! runtextmacro genList("string", "String", "stringList")
[/code]

Example Map w/ Implementation