Hey! You don't actually need to review the Event anymore, as I've moved on
It was nice found, but as it's no instant (vs TriggerEvaluate), it doesn't offer as much functionality. Though I know a scenario where it comes in super handy to have 5ms convenient delay, it's just not that important.
So as I've moved on,
Can you check this system?
[stable][c]Table v1.0.3[/stable]I know it doesn't have all the functionality (TableArr/List miss the flush - method etc.), but how does it look like in general?
Here's a quick demo I made:
scope TestInferface initializer init
//! runtextmacro TABLE_EXTEND ("","sTable","string","Str")
/* Set-up guide:
1. Sort your methods in such order: ( !tm=//! runtextmacro(...) )
!tm TI_TOP()
...
void destroy()
!tm TI_DEALLOC()
...
static thistype create(<stuff>)
local thistype this
!tm TI_ALLOC()
...
!tm TI_BOT()
2. Have non-static method called "fire" in place of "..."
3. Your struct now uses interface! */
private struct ChildA extends array
//! runtextmacro TI_TOP()
private static sTable sT
method destroy takes nothing returns nothing
//! runtextmacro TI_DEALLOC()
endmethod
static method create takes string s returns thistype
local thistype this
//! runtextmacro TI_ALLOC()
set sT[this]=s
return this
endmethod
method fire takes nothing returns nothing
call BJDebugMsg("ChildA says: "+sT[this])
endmethod
private static method onInit takes nothing returns nothing
set sT=Table.create()
endmethod
//! runtextmacro TI_BOT()
endstruct
private struct ChildB extends array
//! runtextmacro TI_TOP()
private static sTable sT
method destroy takes nothing returns nothing
//! runtextmacro TI_DEALLOC()
endmethod
static method create takes string s returns thistype
local thistype this
//! runtextmacro TI_ALLOC()
set sT[this]=s
return this
endmethod
method fire takes nothing returns nothing
call BJDebugMsg("ChildB says: "+sT[this])
endmethod
private static method onInit takes nothing returns nothing
set sT=Table.create()
endmethod
//! runtextmacro TI_BOT()
endstruct
private struct ChildC extends array
//! runtextmacro TI_TOP()
private static sTable sT
method destroy takes nothing returns nothing
//! runtextmacro TI_DEALLOC()
endmethod
static method create takes string s returns thistype
local thistype this
//! runtextmacro TI_ALLOC()
set sT[this]=s
return this
endmethod
method fire takes nothing returns nothing
call BJDebugMsg("ChildC says: "+sT[this])
endmethod
private static method onInit takes nothing returns nothing
set sT=Table.create()
endmethod
//! runtextmacro TI_BOT()
endstruct
private function OnEsc takes nothing returns boolean
local TI_Struct a = ChildA.create("Boo!")
local TI_Struct b = ChildB.create("Boo!")
local TI_Struct c = ChildC.create("Boo!")
// test recycler
call BJDebugMsg("a: "+I2S(a)+" ; b: "+I2S(b)+" ; c: "+I2S(c))
call a.destroy()
call b.destroy()
call c.destroy()
set a = ChildA.create("Boo!")
set b = ChildB.create("Boo!")
set c = ChildC.create("Boo!")
call BJDebugMsg("a: "+I2S(a)+" ; b: "+I2S(b)+" ; c: "+I2S(c))
call a.pop()
call b.pop()
call c.pop()
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddCondition(t,Condition(function OnEsc))
call TriggerRegisterPlayerEvent(t,Player(0),EVENT_PLAYER_END_CINEMATIC)
set t = null
call BJDebugMsg("Hit ESC to test Table Interfaces")
endfunction
endscope
As always, say if you're in hurry and I wont bother you, ehehehe :hohum: