- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
/* macro is a way faster than inline */
#define Compare(offsetx, offsety) \
do { \
int add; \
Point other = Get(g, x + offsetx, y + offsety); \
if(offsety == 0) { \
add = 2 * other.dx + 1; \
} \
else if(offsetx == 0) { \
add = 2 * other.dy + 1; \
} \
else { \
add = 2 * (other.dy + other.dx + 1); \
} \
other.f += add; \
if (other.f < p.f) \
{ \
p.f = other.f; \
if(offsety == 0) { \
p.dx = other.dx + 1; \
p.dy = other.dy; \
} \
else if(offsetx == 0) { \
p.dy = other.dy + 1; \
p.dx = other.dx; \
} \
else { \
p.dy = other.dy + 1; \
p.dx = other.dx + 1; \
} \
} \
} while(0)