• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] [Help] Convert code written on YSI 4.x to 5.x(y_inline and y_malloc)
#5
The documentation covers standard uses. This is a completely non-standard use, and exploits internal details. Those details have never been guaranteed to be stable and change a lot.



Fortunately, rewriting that isn't too hard because the timer doesn't accept any additional parameters (i.e. it is a `SetTimer` wrapper, not a `SetTimerEx` wrapper). Something like this:



PHP Code:
#if defined _inline_timers_included

    #endinput

#endif

#define _inline_timers_included



#include <YSI_Coding\y_inline>



forward InlineTimersHandler(Func:cb<>, bool:repeat);



public 
InlineTimersHandler(Func:cb<>, bool:repeat)

{

    @.
cb();

    if (!
repeat)

    {

        
Indirect_Release(cb);

    }

}



stock SetInlineTimer(Func:cb<>, delaybool:repeat)

{

    new 
timer SetTimerEx("InlineTimersHandler"delay_:repeat"ii"_:cb_:repeat);

    if (
timer)

    {

        
Indirect_SetMeta(cbtimer);

        
Indirect_Claim(cb);

        return 
_:cb;

    }

    return 
0;

}



stock KillInlineTimer(cb)

{

    
KillTimer(Indirect_GetMeta(cb));

    
Indirect_Release(cb);


  Reply


Messages In This Thread
RE: [Help] Convert code written on YSI 4.x to 5.x(y_inline and y_malloc) - by Y_Less - 2019-04-21, 11:14 PM

Forum Jump: