- Joined
- Sep 26, 2009
- Messages
- 9,534
JASS:
library GlobalUtils requires optional GroupUtils
/**
* A small pack to save on re-creating 'private' globals of the same name again
* and again. The GROUP, LOCATION and WORLD_BOUNDS variables should not
* be destroyed as they are meant to replace the need to constantly destroy /
* re-create such variables. I see many systems create a group, location and
* get a world-bounds rect and they would save memory to all share from the
* same library.
*/
static if (LIBRARY_GroupUtils) then
globals
constant group GROUP = ENUM_GROUP
endglobals
else
globals
constant group GROUP = CreateGroup()
endglobals
endif // GROUP - For filters/enums which only last an instant (nearly all)
globals
constant location LOCATION = Location(0.0, 0.0) // For your GetLocationZ() needs.
endglobals
globals
constant rect WORLD_BOUNDS = GetWorldBounds() // For your map-scanning needs.
endglobals
/**
* The below variables are useful for instant filters and should not be expected
* to remember data past a wait period.
*/
globals
unit global_casterUnit = null
unit global_targetUnit = null
unit global_filterUnit = null
endglobals
globals
player global_player = null
player global_player2 = null
endglobals
globals
real global_duration = 0.0
real global_damage = 0.0
real global_x = 0.0
real global_y = 0.0
real global_x2 = 0.0
real global_y2 = 0.0
endglobals
globals
integer global_this = 0 // ie. for structs
integer global_index = 0 // ie. for loops
endglobals
endlibrary
Last edited: