summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-21 11:26:39 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-21 11:26:39 (GMT)
commit4b8ebe4abd98d65c97cf1dbd571d448f53669bc3 (patch)
tree7e2781fe70c221b4d24416c85223737b8a11dc04 /src
parente54eeae8836b65debfdda242c7c39472b901bc70 (diff)
downloadpowder-4b8ebe4abd98d65c97cf1dbd571d448f53669bc3.zip
powder-4b8ebe4abd98d65c97cf1dbd571d448f53669bc3.tar.gz
Air heat simulation now knows about gravity mode. fixes #142
Diffstat (limited to 'src')
-rw-r--r--src/simulation/Air.cpp10
-rw-r--r--src/simulation/Air.h3
-rw-r--r--src/simulation/Simulation.cpp2
3 files changed, 10 insertions, 5 deletions
diff --git a/src/simulation/Air.cpp b/src/simulation/Air.cpp
index 2dfcae0..10c4569 100644
--- a/src/simulation/Air.cpp
+++ b/src/simulation/Air.cpp
@@ -2,6 +2,7 @@
#include <algorithm>
#include "Config.h"
#include "Air.h"
+#include "Simulation.h"
//#include <powder.h>
//#include <defines.h>
#include "Gravity.h"
@@ -110,7 +111,7 @@ void Air::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]);
}
- //if(!gravityMode) TODO: GET REAL VALUE
+ if(!sim.gravityMode)
{ //Vertical gravity only for the time being
float airdiff = hv[y-1][x]-hv[y][x];
if(airdiff>0 && !bmap_blockairh[y-1][x])
@@ -309,9 +310,12 @@ void Air::Invert()
}
}
-Air::Air():
- airMode(0)
+Air::Air(Simulation & simulation):
+ airMode(0),
+ sim(simulation)
{
//Simulation should do this.
make_kernel();
+
+
}
diff --git a/src/simulation/Air.h b/src/simulation/Air.h
index 8fa6f6e..936f54b 100644
--- a/src/simulation/Air.h
+++ b/src/simulation/Air.h
@@ -7,6 +7,7 @@ class Simulation;
class Air
{
public:
+ Simulation & sim;
int airMode;
//Arrays from the simulation
unsigned char (*bmap)[XRES/CELL];
@@ -30,7 +31,7 @@ public:
void update_air(void);
void Clear();
void Invert();
- Air();
+ Air(Simulation & sim);
};
#endif
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 2db746a..23c1a21 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -4520,7 +4520,7 @@ Simulation::Simulation():
gravmap = grav->gravmap;
//Create and attach air simulation
- air = new Air();
+ air = new Air(*this);
//Give air sim references to our data
air->bmap = bmap;
air->emap = emap;