- Joined
- Oct 23, 2011
- Messages
- 182
Is there any downside to using boolexpr like a trigger, instead of using actual trigger? boolexpr seems to use much less memory than creating a trigger.
The code below works just like Nestharus' Event library: pretty much same fps drop and op limit
The code below works just like Nestharus' Event library: pretty much same fps drop and op limit
JASS:
library SmallEvent
private module M
private static method onInit takes nothing returns nothing
set runner = CreateForce()
call ForceAddPlayer(runner, Player(0))
endmethod
endmodule
struct SmallEvent extends array
implement M
boolexpr func
private static force runner = null
private static integer index = 0
method fire takes nothing returns nothing
call ForceEnumPlayers(runner, .func)
endmethod
method register takes code c returns nothing
if .func == null then
set .func = Filter(c)
else
set .func = Or(.func, Filter(c))
endif
endmethod
static method create takes nothing returns thistype
local thistype this = index + 1
set index = this
return this
endmethod
endstruct
endlibrary