summaryrefslogtreecommitdiff
path: root/src/simulation/elements/PUMP.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-12 16:35:21 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-12 16:35:21 (GMT)
commita1a0fb5c0251218cd6fb1b366f7eac6f4711efcb (patch)
treee3dab3f750e5ab607837d18009e3dcd4dba73d2a /src/simulation/elements/PUMP.cpp
parentcc8ae0dc4428dd3f8245ba2a37c8685d4fdf5e84 (diff)
downloadpowder-a1a0fb5c0251218cd6fb1b366f7eac6f4711efcb.zip
powder-a1a0fb5c0251218cd6fb1b366f7eac6f4711efcb.tar.gz
TPT: Fix for PUMP 835d6bbfb9
Diffstat (limited to 'src/simulation/elements/PUMP.cpp')
-rw-r--r--src/simulation/elements/PUMP.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/simulation/elements/PUMP.cpp b/src/simulation/elements/PUMP.cpp
index 17b4749..2d62799 100644
--- a/src/simulation/elements/PUMP.cpp
+++ b/src/simulation/elements/PUMP.cpp
@@ -59,16 +59,12 @@ int Element_PUMP::update(UPDATE_FUNC_ARGS)
if (parts[i].temp<= -256.0+273.15)
parts[i].temp = -256.0+273.15;
- if (sim->pv[y/CELL][x/CELL]<(parts[i].temp-273.15))
- sim->pv[y/CELL][x/CELL] += 0.1f*((parts[i].temp-273.15)-sim->pv[y/CELL][x/CELL]);
- if (y+CELL<YRES && sim->pv[y/CELL+1][x/CELL]<(parts[i].temp-273.15))
- sim->pv[y/CELL+1][x/CELL] += 0.1f*((parts[i].temp-273.15)-sim->pv[y/CELL+1][x/CELL]);
- if (x+CELL<XRES)
- {
- sim->pv[y/CELL][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-sim->pv[y/CELL][x/CELL+1]);
- if (y+CELL<YRES)
- sim->pv[y/CELL+1][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-sim->pv[y/CELL+1][x/CELL+1]);
- }
+ for (rx=-1; rx<2; rx++)
+ for (ry=-1; ry<2; ry++)
+ if ((x+rx)-CELL>=0 && (y+ry)-CELL>0 && (x+rx)+CELL<XRES && (y+ry)+CELL<YRES && !(rx && ry))
+ {
+ sim->pv[(y/CELL)+ry][(x/CELL)+rx] += 0.1f*((parts[i].temp-273.15)-sim->pv[(y/CELL)+ry][(x/CELL)+rx]);
+ }
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -99,4 +95,4 @@ int Element_PUMP::graphics(GRAPHICS_FUNC_ARGS)
}
-Element_PUMP::~Element_PUMP() {} \ No newline at end of file
+Element_PUMP::~Element_PUMP() {}