From ae3c9ddf3950c42cc68e1eca73fe84fdd8eddfd0 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Fri, 24 Aug 2012 20:36:23 +0100 Subject: Don't you just hate those fencepost errors... Stop going out of bounds when traversing the X axis with gravity mask. diff --git a/src/simulation/Gravity.cpp b/src/simulation/Gravity.cpp index e5daa65..552c02d 100644 --- a/src/simulation/Gravity.cpp +++ b/src/simulation/Gravity.cpp @@ -420,13 +420,13 @@ void Gravity::grav_mask_r(int x, int y, char checkmap[YRES/CELL][XRES/CELL], cha *shapeout = 1; int x1 = x, x2 = x; - while (x1 >= 0) + while (x1 >= 1) { if(checkmap[y][x1-1] || bmap[y][x1-1]==WL_GRAV) break; x1--; } - while (x2 < XRES/CELL) + while (x2 < (XRES/CELL)-1) { if(checkmap[y][x2+1] || bmap[y][x2+1]==WL_GRAV) break; -- cgit v0.9.2-21-gd62e