Made cbasetypes.h more C++ compatible (#2315)

* Removed inline macro in cbasetypes.h
* Renamed swap macro to avoid name clash with std::swap
This commit is contained in:
Jittapan Pluemsumran
2017-08-07 06:33:47 +07:00
committed by GitHub
parent 829f0a1f59
commit a46e012619
11 changed files with 39 additions and 37 deletions

View File

@@ -697,9 +697,9 @@ int map_foreachinareaV(int(*func)(struct block_list*, va_list), int16 m, int16 x
return 0;
if (x1 < x0)
swap(x0, x1);
SWAP(x0, x1);
if (y1 < y0)
swap(y0, y1);
SWAP(y0, y1);
x0 = i16max(x0, 0);
y0 = i16max(y0, 0);
@@ -863,9 +863,9 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x
return 0;
if ( x1 < x0 )
swap(x0, x1);
SWAP(x0, x1);
if ( y1 < y0 )
swap(y0, y1);
SWAP(y0, y1);
x0 = i16max(x0, 0);
y0 = i16max(y0, 0);
@@ -930,9 +930,9 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_
y1 = center->y + range;
if ( x1 < x0 )
swap(x0, x1);
SWAP(x0, x1);
if ( y1 < y0 )
swap(y0, y1);
SWAP(y0, y1);
if( dx == 0 || dy == 0 ) {
//Movement along one axis only.
@@ -1158,9 +1158,9 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i
//The two fors assume mx0 < mx1 && my0 < my1
if ( mx0 > mx1 )
swap(mx0, mx1);
SWAP(mx0, mx1);
if ( my0 > my1 )
swap(my0, my1);
SWAP(my0, my1);
mx0 = max(mx0, 0);
my0 = max(my0, 0);
@@ -1308,9 +1308,9 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0,
//The following assumes mx0 < mx1 && my0 < my1
if (mx0 > mx1)
swap(mx0, mx1);
SWAP(mx0, mx1);
if (my0 > my1)
swap(my0, my1);
SWAP(my0, my1);
//Apply width to the path by turning 90 degrees
mx0 -= abs(range*dirx[(dir + 2) % 8]);