diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2011-05-28 09:33:13 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-05-28 10:51:57 (GMT) |
| commit | ab7cd2e5f6f63467d806779c6bcea85ecb97c78d (patch) | |
| tree | 961803d89ec576e12df39dbc1760713959bd7eab /src | |
| parent | 420f8e7442077aab83b92270bef22f123113af73 (diff) | |
| download | powder-ab7cd2e5f6f63467d806779c6bcea85ecb97c78d.zip powder-ab7cd2e5f6f63467d806779c6bcea85ecb97c78d.tar.gz | |
Skip some calls to do_move for liquids
No liquid can occupy the same space as itself unless in E-Hole
Diffstat (limited to 'src')
| -rw-r--r-- | src/powder.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/powder.c b/src/powder.c index 544430b..34328f3 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2061,19 +2061,21 @@ killed: rt = 10; for (j=clear_x+r; j>=0 && j>=clear_x-rt && j<clear_x+rt && j<XRES; j+=r) { - if (s=do_move(i, x, y, (float)j, fin_yf)) + if (((pmap[fin_y][j]&0xFF)!=t || bmap[fin_y/CELL][j/CELL]) + && (s=do_move(i, x, y, (float)j, fin_yf))) { nx = (int)(parts[i].x+0.5f); ny = (int)(parts[i].y+0.5f); break; } - if (fin_y!=clear_y && (s=do_move(i, x, y, (float)j, clear_yf))) + if (fin_y!=clear_y && ((pmap[clear_y][j]&0xFF)!=t || bmap[clear_y/CELL][j/CELL]) + && (s=do_move(i, x, y, (float)j, clear_yf))) { nx = (int)(parts[i].x+0.5f); ny = (int)(parts[i].y+0.5f); break; } - if ((pmap[y][j]&255)!=t || (bmap[y/CELL][j/CELL] && bmap[y/CELL][j/CELL]!=WL_STREAM)) + if ((pmap[fin_y][j]&0xFF)!=t || (bmap[fin_y/CELL][j/CELL] && bmap[fin_y/CELL][j/CELL]!=WL_STREAM)) break; } if (parts[i].vy>0) @@ -2083,7 +2085,7 @@ killed: if (s==1) for (j=ny+r; j>=0 && j<YRES && j>=ny-rt && j<ny+rt; j+=r) { - if (do_move(i, nx, ny, (float)nx, (float)j)) + if (((pmap[j][nx]&0xFF)!=t || bmap[j/CELL][nx/CELL]) && do_move(i, nx, ny, (float)nx, (float)j)) break; if ((pmap[j][nx]&255)!=t || (bmap[j/CELL][nx/CELL] && bmap[j/CELL][nx/CELL]!=WL_STREAM)) break; |
