Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: jcj94 on April 06, 2011, 10:03:43 PM

Title: Predetermined Unit Offsets...
Post by: jcj94 on April 06, 2011, 10:03:43 PM
I'm not sure if this has been resolved, because I remember reading awhile back that someone wanted to "automatically add" the unit offsets of +31 and -1 .  While searching through SDK code and found these lines

Code: [Select]
// Useful macros
#define MkXY(x,y) (LOCATION(x+31,y-1))
#define MkRect(x1,y1,x2,y2) (MAP_RECT(LOCATION(x1+31,y1-1),LOCATION(x2+31,y2-1)))
#define XYPos(x,y) x+31,y-1
#define RectPos(x1,y1,x2,y2) x1+31,y1-1,x2+31,y2-1

// X and Y offset consts
const int X_ = 31;
const int Y_ = -1;


I found these while looking through the OP2Helper.h file that is included.  I am unsure if thise would help or not, but could it?
Title: Predetermined Unit Offsets...
Post by: Sirbomber on April 06, 2011, 10:10:28 PM
No, because on "around the world" style maps the offset is (-1, -1) and we have no way of knowing map dimensions at compile time.
Title: Predetermined Unit Offsets...
Post by: BlackBox on April 06, 2011, 11:25:55 PM
It's already in the SDK header files, why does this need to be reposted in the forum?

Honestly these macros aren't even that good because the x and y aren't wrapped in parentheses so order of operations could end up being ambiguous.