drol
New Member
- Reaction score
- 7
Hey guys,
I'm currently wondering if I should destroy a local struct or not.
I'm not all that familiar yet with vJass, so I don't know what to do.
Here is what I have in my map:
Some library
My trigger:
Trigger 2: (not really that intresting)
So my question is, should I destroy tower in Trigger1 or not? Does it leak or? And where is the editing saved, is the local just a pointer?
(Btw, advise like; don't use the local just keep calling the getTower(unit) is a bit inefficient I think, since I use the local a lot in the trigger1 code.)
Thanks for helping! Will +rep
I'm currently wondering if I should destroy a local struct or not.
I'm not all that familiar yet with vJass, so I don't know what to do.
Here is what I have in my map:
Some library
JASS:
globals
Tower array Towers
endglobals
My trigger:
JASS:
function Trig_Bounty_Actions takes nothing returns nothing
// getTower grabs the struct matching the unit from the Towers array (see
// trigger 2)
local Tower tower = getTower(GetKillingUnit())
// editing some values of tower, like:
set tower.experience = tower.experience + 1
// to destroy tower or not to destroy tower?
Trigger 2: (not really that intresting)
JASS:
function getTower takes unit u returns Tower
local integer i = 1
loop
exitwhen i > TowersCounter
if ( Towers<i>.getUnit() == u ) then
return Towers<i>
endif
set i = i + 1
endloop
return Tower.create(u,GetOwningPlayer(u),TowerType.create(0,0,0,0,false),0)
endfunction</i></i>
So my question is, should I destroy tower in Trigger1 or not? Does it leak or? And where is the editing saved, is the local just a pointer?
(Btw, advise like; don't use the local just keep calling the getTower(unit) is a bit inefficient I think, since I use the local a lot in the trigger1 code.)
Thanks for helping! Will +rep