Author Topic: Predetermined Unit Offsets...  (Read 1931 times)

Offline jcj94

  • Sr. Member
  • ****
  • Posts: 407
    • http://techfusion-279.com
Predetermined Unit Offsets...
« 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?
« Last Edit: April 06, 2011, 10:04:11 PM by jcj94 »

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Predetermined Unit Offsets...
« Reply #1 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.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Predetermined Unit Offsets...
« Reply #2 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.