Don't you just hate those fencepost errors... Stop going out of bounds when traversing the X axis with gravity mask.

This commit is contained in:
Simon Robertshaw 2012-08-24 20:36:23 +01:00
parent 98da88e34f
commit ae3c9ddf39

View File

@ -420,13 +420,13 @@ void Gravity::grav_mask_r(int x, int y, char checkmap[YRES/CELL][XRES/CELL], cha
*shapeout = 1; *shapeout = 1;
int x1 = x, x2 = x; int x1 = x, x2 = x;
while (x1 >= 0) while (x1 >= 1)
{ {
if(checkmap[y][x1-1] || bmap[y][x1-1]==WL_GRAV) if(checkmap[y][x1-1] || bmap[y][x1-1]==WL_GRAV)
break; break;
x1--; x1--;
} }
while (x2 < XRES/CELL) while (x2 < (XRES/CELL)-1)
{ {
if(checkmap[y][x2+1] || bmap[y][x2+1]==WL_GRAV) if(checkmap[y][x2+1] || bmap[y][x2+1]==WL_GRAV)
break; break;