- Joined
- Apr 27, 2011
- Messages
- 272
Is this method better
than just using an instance counter and an unit array?
JASS:
library DummyStack
//===========================================================================
globals
private group G=CreateGroup()
endglobals
//===========================================================================
function NewDummy takes player pl, real x, real y, real f returns unit
local unit u=FirstOfGroup(G)
if(u==null)then
set u=CreateUnit(...)
else
call SetUnitOwner(...)
...
call GroupRemoveUnit(G,u)
endif
return u
endfunction
//===========================================================================
function RecycleDummy takes unit u returns nothing
call SetUnitOwner(u,Player(15),false)
call GroupAddUnit(G,u)
endfunction
//===========================================================================
endlibrary
than just using an instance counter and an unit array?