Should fix any border crashes
This commit is contained in:
parent
64629df1af
commit
c0947d9fea
@ -61,7 +61,7 @@ int trymovetron(int x, int y, int dir, int i, int len)
|
||||
for (tx = rx - tron_ry[dir] , ty = ry - tron_rx[dir], j=1; abs(tx-rx) < (len-k) && abs(ty-ry) < (len-k); tx-=tron_ry[dir],ty-=tron_rx[dir],j++)
|
||||
{
|
||||
r = pmap[ty][tx];
|
||||
if (!r && !bmap[(ty)/CELL][(tx)/CELL] && ry > CELL && rx > CELL && ry < YRES-CELL && rx < XRES-CELL)
|
||||
if (!r && !bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL)
|
||||
{
|
||||
if (j == (len-k))//there is a safe path, so we can break out
|
||||
return len+1;
|
||||
@ -73,7 +73,7 @@ int trymovetron(int x, int y, int dir, int i, int len)
|
||||
for (tx = rx + tron_ry[dir] , ty = ry + tron_rx[dir], j=1; abs(tx-rx) < (len-k) && abs(ty-ry) < (len-k); tx+=tron_ry[dir],ty+=tron_rx[dir],j++)
|
||||
{
|
||||
r = pmap[ty][tx];
|
||||
if (!r && !bmap[(ty)/CELL][(tx)/CELL] && ry > CELL && rx > CELL && ry < YRES-CELL && rx < XRES-CELL)
|
||||
if (!r && !bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL)
|
||||
{
|
||||
if (j == (len-k))
|
||||
return len+1;
|
||||
|
Reference in New Issue
Block a user