diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-05 17:35:12 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-05 17:35:12 (GMT) |
| commit | 4ce22e4e7705224a9b4c1b9bfa8886de0029a3e3 (patch) | |
| tree | d9c02db57d9a20709758d7b771ee60ea9cbe4e88 /src/simulation/Simulation.cpp | |
| parent | 30f8049efc6efc086509d235df413e4932dab83e (diff) | |
| download | powder-4ce22e4e7705224a9b4c1b9bfa8886de0029a3e3.zip powder-4ce22e4e7705224a9b4c1b9bfa8886de0029a3e3.tar.gz | |
Wall Edge option, fixes #70
Diffstat (limited to 'src/simulation/Simulation.cpp')
| -rw-r--r-- | src/simulation/Simulation.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 4fb9ac2..64969e1 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -750,6 +750,41 @@ int Simulation::create_part_add_props(int p, int x, int y, int tv, int rx, int r return p; } +void Simulation::SetEdgeMode(int newEdgeMode) +{ + edgeMode = newEdgeMode; + switch(edgeMode) + { + case 0: + for(int i = 0; i<(XRES/CELL); i++) + { + bmap[0][i] = 0; + bmap[YRES/CELL-1][i] = 0; + } + for(int i = 1; i<((YRES/CELL)-1); i++) + { + bmap[i][0] = 0; + bmap[i][XRES/CELL-1] = 0; + } + break; + case 1: + int i; + for(i=0; i<(XRES/CELL); i++) + { + bmap[0][i] = WL_WALL; + bmap[YRES/CELL-1][i] = WL_WALL; + } + for(i=1; i<((YRES/CELL)-1); i++) + { + bmap[i][0] = WL_WALL; + bmap[i][XRES/CELL-1] = WL_WALL; + } + break; + default: + SetEdgeMode(0); + } +} + void Simulation::ApplyDecoration(int x, int y, int colR_, int colG_, int colB_, int colA_, int mode) { int rp; @@ -1801,6 +1836,7 @@ void Simulation::clear_sim(void) grav->Clear(); if(air) air->Clear(); + SetEdgeMode(edgeMode); } void Simulation::init_can_move() { |
