summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-05-15 12:18:24 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-19 14:53:23 (GMT)
commit7482e4d07134b1ef8b1d0715f49396dbf525523b (patch)
tree063bac6dd1e7111339703594ad407163768d6117 /src
parent68c4d6d6214979b4a99caff2a0d4e6f543790c3e (diff)
downloadpowder-7482e4d07134b1ef8b1d0715f49396dbf525523b.zip
powder-7482e4d07134b1ef8b1d0715f49396dbf525523b.tar.gz
Small fix for liquid and powder movement
Diffstat (limited to 'src')
-rw-r--r--src/powder.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/powder.c b/src/powder.c
index 3f5898e..1fc094d 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -2022,13 +2022,12 @@ killed:
// but no point trying this if particle is stuck in a block of identical particles
dx = parts[i].vx - parts[i].vy*r;
dy = parts[i].vy + parts[i].vx*r;
- if (fabsf(dy)>fabsf(dx)) {
- dx /= fabsf(dy);
- dy /= fabsf(dy);
- } else {
- dx /= fabsf(dx);
- dy /= fabsf(dx);
- }
+ if (fabsf(dy)>fabsf(dx))
+ mv = fabsf(dy);
+ else
+ mv = fabsf(dx);
+ dx /= mv;
+ dy /= mv;
if (do_move(i, x, y, clear_xf+dx, clear_yf+dy))
{
parts[i].vx *= ptypes[t].collision;