- Joined
- Jul 10, 2007
- Messages
- 6,306
library WorldBounds
//struct WorldBounds extends array
//static readonly rect world
// same as GetWorldBounds()
//static readonly region worldRegion
// contains world for triggers
//static readonly real maxX
//static readonly real maxY
//static readonly real minX
//static readonly real minY
//static readonly real centerX
//static readonly real centerY
struct WorldBounds extends array
readonly static real maxX = 0.
readonly static real maxY = 0.
readonly static real minX = 0.
readonly static real minY = 0.
readonly static real centerX = 0.
readonly static real centerY = 0.
readonly static rect world = null
readonly static region worldRegion = null
private static method onInit takes nothing returns nothing
set world = GetWorldBounds()
set maxX = GetRectMaxX(world)
set maxY = GetRectMaxY(world)
set minX = GetRectMinX(world)
set maxY = GetRectMaxY(world)
set centerX = (maxX+minX)/2
set centerY = (minY+maxY)/2
set worldRegion = CreateRegion()
call RegionAddRect(worldRegion, world)
endmethod
endstruct
endlibrary
//Generated method caller for world
function s_WorldBounds__world_operator takes integer this returns rect
return s_WorldBounds__world[this]
endfunction
unit array s__retro_subject
is all that gets compiled from it.Yeah; I realized that shortly after I looked more at it. You beat me to deleting my post. lol.
Although at least my map has an issue where it'd be good if map borders were sorta changeable; but i think it'd effect other scripts. So I might just use an border maxX, maxY, minX, MinY(that's set in another library that is not readonly) thats also set that will fall within the WorldBounds for spells that move units similar to blink etc.
Even I sorta agree with Troll-Brain here I can't see a reason for why you'd want an rect instead.
set centerX=(maxX+minX)/2
set centerY=(minY+maxY)/2
module WorldBoundsInit
private static boolean CUSTOM_MAP_BOUNDS = true
private static method onInit takes nothing returns nothing
// bla bla bla
static if CUSTOM_MAP_BOUNDS then
set centerX=(maxX+minX)/2
set centerY=(minY+maxY)/2
else
set centerX=0
set centerY=0
endif
// bla bla bla
endmethod
endmodule