TriggerHappy
...
- Reaction score
- 341
It requires no preloading and can be parsed directly inside the editor. I've made a litte framework for anyone who wants to use this;
Set NOT_HANDLE to true if the return value is not a hande (integer may be the only thing that would require you to set it to true).
Set NOT_HANDLE to true if the return value is not a hande (integer may be the only thing that would require you to set it to true).
JASS:
library Typecast
globals
private hashtable HASH = InitHashtable()
endglobals
//! textmacro TYPECAST_MACRO takes NAME, HANDLE, RETURN, HASHFUNC, NOT_HANDLE
function $NAME$ takes $HANDLE$ var returns $RETURN$
static if ($NOT_HANDLE$) then
call SaveFogStateHandle(HASH, 0,0, ConvertFogState(var))
return $HASHFUNC$(HASH, 0, 0)
else
call SaveFogStateHandle(HASH, 0, 0, ConvertFogState(GetHandleId(var)))
return $HASHFUNC$(HASH, 0, 0)
endif
endfunction
//! endtextmacro
//! runtextmacro TYPECAST_MACRO("I2U", "integer", "unit", "LoadUnitHandle", "true")
endlibrary