Fix bounds check for WIND line

This commit is contained in:
jacksonmj 2011-07-08 20:08:40 +08:00 committed by Simon Robertshaw
parent 812acd6663
commit 52b4473f0f

View File

@ -3043,7 +3043,7 @@ int main(int argc, char *argv[])
{ {
for (j=-bsy; j<=bsy; j++) for (j=-bsy; j<=bsy; j++)
for (i=-bsx; i<=bsx; i++) for (i=-bsx; i<=bsx; i++)
if (x+i>0 && y+j>0 && x+i<XRES && y+j<YRES && ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(bsx,2))+(pow(j,2))/(pow(bsy,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx))) if (lx+i>=0 && ly+j>=0 && lx+i<XRES && ly+j<YRES && ((CURRENT_BRUSH==CIRCLE_BRUSH && pow(i,2)*pow(bsy,2)+pow(j,2)*pow(bsx,2)<=pow(bsx,2)*pow(bsy,2))||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx)))
{ {
vx[(ly+j)/CELL][(lx+i)/CELL] += (x-lx)*0.002f; vx[(ly+j)/CELL][(lx+i)/CELL] += (x-lx)*0.002f;
vy[(ly+j)/CELL][(lx+i)/CELL] += (y-ly)*0.002f; vy[(ly+j)/CELL][(lx+i)/CELL] += (y-ly)*0.002f;