Hello there, just me and my optimization attempts at work. Previously I've been using a loop to determine if something is part of an array, however it recently occured to me that the tag '####' is really an integer id.
That in mind;
However, I'm not entirely sure if this is an advisible idea. I'm aware the maximum array value is 8190, which I would hope would not be surpassed. This seems almost to good to be true, could anyone confirm/deny if this is a valid way to handle this code?
(If so, does anyone happen to know the minimum possible handle for a trackable?)
That in mind;
JASS:
struct CASTING_EVENT
integer sid
trigger use
boolean override = false
endstruct
globals
CASTING_EVENT array CASTING_EVENTS
unit CASTING_EVENT_CASTER
endglobals
constant function MINIMUM_SPELL_HANDLE_ID takes nothing returns integer
return 'A000'
endfunction
function ENGINE_REGISTER_CASTING_EVENT takes CASTING_EVENT cs returns nothing
set CASTING_EVENTS[cs.sid - MINIMUM_SPELL_HANDLE_ID] = cs
endfunction
function IsSpellRegistered takes integer sid returns trigger
local integer I = sid - MINIMUM_SPELL_HANDLE_ID
if(CASTING_EVENTS[I] != 0)then
return CASTING_EVENTS[I].use
endif
return null
endfunction
However, I'm not entirely sure if this is an advisible idea. I'm aware the maximum array value is 8190, which I would hope would not be surpassed. This seems almost to good to be true, could anyone confirm/deny if this is a valid way to handle this code?
(If so, does anyone happen to know the minimum possible handle for a trackable?)