- Joined
- Jun 16, 2005
- Messages
- 36
Here are 'standard' Return Bug/ Super Custom Value functions.
This two functions were made to easier effect destruction. The idea is to make a function, which creates a trigger for effect to be destructed.
But somwhere there is a leak. How can I avoid it?
JASS:
function HandleToIntegerRB takes handle h returns integer
return h
return 0
endfunction
function ReturnEffectRB takes integer i returns effect
return i
return null
endfunction
function LoadValueSCV takes handle h, string key returns integer
return GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key)
endfunction
function LoadEffectSCV takes handle h, string key returns effect
return ReturnEffectRB(GetStoredInteger(udg_cache, I2S(HandleToIntegerRB(h)), key))
endfunction
function FlushObjectSCV takes handle h returns nothing
call FlushStoredMission(udg_cache, I2S(HandleToIntegerRB(h)))
endfunction
function StoreObjectSCV takes handle h, string key, integer val returns nothing
call StoreInteger(udg_cache, I2S(HandleToIntegerRB(h)), key, val)
endfunction
This two functions were made to easier effect destruction. The idea is to make a function, which creates a trigger for effect to be destructed.
JASS:
function DEA takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local effect e = LoadEffectSCV(t, "sp_effect")
local integer i = LoadValueSCV(t, "time")
call PolledWait(i)
call DestroyEffect(e)
set e = null
set i = 0
call DestroyTrigger(t)
set t = null
call FlushObjectSCV(t)
endfunction
function DestroyEffectSCV takes effect e, integer t returns nothing
local trigger trig
set trig = CreateTrigger( )
call StoreObjectSCV(trig, "sp_effect", HandleToIntegerRB(e) )
call StoreObjectSCV(trig, "time", t)
call TriggerAddAction( trig, function DEA)
endfunction