- Joined
- Sep 10, 2012
- Messages
- 39
I am attempting to create a system that takes over life/mana regeneration, so that I can easily manipulate it. Simple enough in function, but I'm unable plug the leaks.
Here's the code:
the RegenHandleID, and the attempted annulment, were my attempts at closing what I can only guess is a leak of integer values, although I have not read of them.
I've read two different memory leak tutorials and done my best to apply the information therein. But it should be noted that I am quite new to JASS/vJASS, so I am still not aware of all aspects of memory leaks, and all the things that cause them.
Any assistance provided in this is greatly appreciated.
Here's the code:
JASS:
function Regenerate takes nothing returns nothing
local unit RegenUnit = GetEnumUnit()
//local integer RegenHandleID = GetHandleId(RegenUnit)
call SetUnitLifeBJ( RegenUnit, ( GetUnitStateSwap(UNIT_STATE_LIFE, RegenUnit) + LoadReal(udg_HashTable_Attributes, GetHandleId(RegenUnit), 70 ) ))
// set RegenHandleID = null
set RegenUnit = null
endfunction
function Trig_Regeneration_Actions takes nothing returns nothing
local group UnitsInMap = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroup(UnitsInMap, function Regenerate)
call DestroyGroup(UnitsInMap)
set UnitsInMap = null
endfunction
//===========================================================================
function InitTrig_Regeneraton takes nothing returns nothing
set gg_trg_Regeneraton = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Regeneraton, 1.00 )
call TriggerAddAction( gg_trg_Regeneraton, function Trig_Regeneration_Actions )
endfunction
the RegenHandleID, and the attempted annulment, were my attempts at closing what I can only guess is a leak of integer values, although I have not read of them.
I've read two different memory leak tutorials and done my best to apply the information therein. But it should be noted that I am quite new to JASS/vJASS, so I am still not aware of all aspects of memory leaks, and all the things that cause them.
Any assistance provided in this is greatly appreciated.