summaryrefslogtreecommitdiff
path: root/src/simulation/Simulation.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-05 13:03:54 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-05 13:03:54 (GMT)
commit351ce1525f570a52d571d1da720ae4f6a5815a22 (patch)
tree8d368a20635c6ac5901acc8ad0d90adf2afacdbc /src/simulation/Simulation.cpp
parent05024cc7870606ea9a2ca3840811a665748d52fb (diff)
downloadpowder-351ce1525f570a52d571d1da720ae4f6a5815a22.zip
powder-351ce1525f570a52d571d1da720ae4f6a5815a22.tar.gz
Update gravity walls, fixes issue #52
Diffstat (limited to 'src/simulation/Simulation.cpp')
-rw-r--r--src/simulation/Simulation.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 59ff5d1..8717faa 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -114,7 +114,7 @@ int Simulation::Load(int fullX, int fullY, GameSave * save)
}
}
- grav->gravity_mask();
+ gravWallChanged = true;
return 0;
}
@@ -232,6 +232,8 @@ void Simulation::clear_area(int area_x, int area_y, int area_w, int area_h)
{
for (cx=0; cx<area_w; cx++)
{
+ if(bmap[(cy+area_y)/CELL][(cx+area_x)/CELL] == WL_GRAV)
+ gravWallChanged = true;
bmap[(cy+area_y)/CELL][(cx+area_x)/CELL] = 0;
delete_part(cx+area_x, cy+area_y, 0);
}
@@ -1240,6 +1242,10 @@ int Simulation::CreateWalls(int x, int y, int rx, int ry, int c, int flags, Brus
fvx[j][i] = 0.0f;
fvy[j][i] = 0.0f;
}
+ if (b==WL_GRAV || bmap[j][i]==WL_GRAV)
+ {
+ gravWallChanged = true;
+ }
if (b==WL_STREAM)
{
i = x + rx/2;
@@ -1253,7 +1259,6 @@ int Simulation::CreateWalls(int x, int y, int rx, int ry, int c, int flags, Brus
bmap[j][i] = WL_STREAM;
continue;
}
- if (b==0 && bmap[j][i]==WL_GRAV) gravwl_timeout = 60;
bmap[j][i] = b;
}
}
@@ -4341,6 +4346,12 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
gravy = grav->gravy;
gravp = grav->gravp;
gravmap = grav->gravmap;
+
+ if(gravWallChanged)
+ {
+ grav->gravity_mask();
+ gravWallChanged = false;
+ }
}
}