summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2012-06-12 23:42:30 (GMT)
committer jacksonmj <mj-pt@jacksonmj.co.uk>2012-06-12 23:56:22 (GMT)
commit6c3034acffc79f810d20cd04d14134c7ac2ada0e (patch)
tree6ca1437725e96c365f5c67dd0c337045731189ac /src
parent35d125cf532fdd329cee6f87d0fa26a59d804567 (diff)
downloadpowder-6c3034acffc79f810d20cd04d14134c7ac2ada0e.zip
powder-6c3034acffc79f810d20cd04d14134c7ac2ada0e.tar.gz
Make ambient heat convection work a bit better
Previously, it was comparing the temperature of the current cell to the average of the cells around it (plus some advection affecting the average, but that makes no difference if the air starts out stationary), and basing the velocity change on this temperature difference. If the cell below is hotter and the cell above is cooler, the air should rise. But in this case, the average of surrounding cells tends to be near the temperature of the current cell, so not much happens. Just using the temperature difference between the current cell and the cell above makes convection work a lot better.
Diffstat (limited to 'src')
-rw-r--r--src/air.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/air.c b/src/air.c
index eb7f47f..1759883 100644
--- a/src/air.c
+++ b/src/air.c
@@ -118,10 +118,10 @@ void update_airh(void)
dh += AIR_VADV*(1.0f-tx)*ty*(bmap_blockairh[j+1][i] ? odh : hv[j+1][i]);
dh += AIR_VADV*tx*ty*(bmap_blockairh[j+1][i+1] ? odh : hv[j+1][i+1]);
}
+ pv[y][x] += (dh-hv[y][x])/5000.0f;
if(!gravityMode){ //Vertical gravity only for the time being
- float airdiff = dh-hv[y][x];
- pv[y][x] += airdiff/5000.0f;
- if(airdiff>0)
+ float airdiff = hv[y-1][x]-hv[y][x];
+ if(airdiff>0 && !bmap_blockairh[y-1][x])
vy[y][x] -= airdiff/5000.0f;
}
ohv[y][x] = dh;