@@ -78,22 +78,18 @@ enum {
CORRECT_Z_BITS = 1 << 1 | 1 << 2 | 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 7
};
#define CORRECT_Z(tileh) (CORRECT_Z_BITS & (1 << tileh))
#define TILE_ASSERT(x) assert( TILE_MASK(x) == (x) );
extern uint SafeTileAdd(uint x, int add, const char *exp, const char *file, int line);
uint SafeTileAdd(uint x, int add, const char *exp, const char *file, int line);
#if !defined(_DEBUG)
# define TILE_ADD(x,y) ((x)+(y))
#else
# if defined(__GNUC__)
# define TILE_ADD(x,y) (SafeTileAdd((x),(y), #x ", " #y, __FILE__, __LINE__))
# else
# define TILE_ADD(x,y) (SafeTileAdd((x),(y), #x ## ", " ## #y, __FILE__, __LINE__))
# endif
#endif
#define TILE_ADDXY(tile, x, y) TILE_ADD(tile, TILE_XY(x,y))
//#define REMADP_COORDS(x,y,z) { int t = x; x = (y-t)*2; y+=t-z; }
@@ -727,13 +727,13 @@ int FindFirstBit(uint32 value)
if (value & 0x0000000c) { value >>= 2; i += 2; }
if (value & 0x00000002) { i += 1; }
return i;
}
extern uint SafeTileAdd(uint tile, int add, const char *exp, const char *file, int line)
uint SafeTileAdd(uint tile, int add, const char *exp, const char *file, int line)
{
uint x = TileX(tile) + (signed char)(add & 0xFF);
uint y = TileY(tile) + ((((0x8080 + add)>>8) & 0xFF) - 0x80);
if (x >= MapSizeX() || y >= MapSizeY()) {
char buf[512];
Status change: