Moderator
M
Moderator
15:02, 1st Jul 2013
PurgeandFire: Changes made. Approved!
PurgeandFire: Changes made. Approved!
(4 ratings)
|
//*************************************************************************************
//*
//* World Bounds Functions by Almia
//*
//*************************************************************************************
//*
//* API
//*
//* function IsXInMap takes real x returns boolean
//* function IsYInMap takes real y returns boolean
//* function IsPointInMap takes real x, real y returns boolean
//* - Checks if coordinates is in map.
//*
//* function BoundX takes real x returns real
//* function BoundY takes real y returns real
//* - Bounds the value of coordinate to min/max values if they are greater/less than min/max values.
//*
//* function SetUnitBoundedX takes unit u, real x returns nothing
//* function SetUnitBoundedY takes unit u, real y returns nothing
//* - Moves unit in a bounded coordinate
//*
//*************************************************************************************
function IsXInMap takes real x returns boolean
return x >= udg_WB_MinX and x < udg_WB_MaxX
endfunction
function IsYInMap takes real y returns boolean
return y >= udg_WB_MinY and y < udg_WB_MaxY
endfunction
function IsPointInMap takes real x, real y returns boolean
return IsXInMap(x) and IsYInMap(y)
endfunction
function BoundX takes real x returns real
if udg_WB_MinX > x then
return udg_WB_MinX
elseif udg_WB_MaxX < x then
return udg_WB_MaxX
endif
return x
endfunction
function BoundY takes real y returns real
if udg_WB_MinY > y then
return udg_WB_MinY
elseif udg_WB_MaxY < y then
return udg_WB_MaxY
endif
return y
endfunction
function SetUnitBoundedX takes unit u, real x returns nothing
call SetUnitX(u, BoundX(x))
endfunction
function SetUnitBoundedY takes unit u, real y returns nothing
call SetUnitY(u, BoundY(y))
endfunction
Fair enough. 5/5I don't think so
Let it private as it is. Some maps that has multimaps may have use the MaxX,MaxY etc.
I do noticed that it uses integers,however,GUI doesn't allow one to typecast integers to reals directly. (Integer can be typecasted to reals if you use them as of how you used reals). So,I chose reals so that users can easily use this than opening Convert - Integer to Real all over again,
function BoundY takes real y returns real
if udg_WB_MinY > y then
return udg_WB_MinY
elseif udg_WB_MaxX < y then // change to udg_WB_MaxY
return udg_WB_MaxY
endif
return y
endfunction
The thing is, not many knows how to use it. Therefore the system is useful.
Also, rather a simple system than an advanced system. simple +useful=good system
It is just the same. Blizzard Math is slow(source : Nes)
Yep.
I think Ill add some functionalities.
call SetUnitY(u, BoundX(y))
call SetUnitY(u, BoundY(y))
.The GUI part is for the variable copy.
I think not.GUI / Triggers
Why?~Reserved
I don't understand that statement.