diff options
| author | jacob1 <jfu614@gmail.com> | 2012-12-06 15:56:24 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2012-12-06 15:56:24 (GMT) |
| commit | 2d7ac84c1dca8521f41cf023774b7a90e300b3bf (patch) | |
| tree | 115eaf6632e3a9821b3374879e1e608091d09f80 /src/simulation/elements/TRON.cpp | |
| parent | 4654a2aaa0c7a48583ec3e1b2b3d1c0923afc0cd (diff) | |
| download | powder-2d7ac84c1dca8521f41cf023774b7a90e300b3bf.zip powder-2d7ac84c1dca8521f41cf023774b7a90e300b3bf.tar.gz | |
give TRON the ability to go through activated SWCH
Diffstat (limited to 'src/simulation/elements/TRON.cpp')
| -rw-r--r-- | src/simulation/elements/TRON.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/simulation/elements/TRON.cpp b/src/simulation/elements/TRON.cpp index 36493a7..264b719 100644 --- a/src/simulation/elements/TRON.cpp +++ b/src/simulation/elements/TRON.cpp @@ -199,13 +199,13 @@ int Element_TRON::trymovetron(Simulation * sim, int x, int y, int dir, int i, in rx += tron_rx[dir]; ry += tron_ry[dir]; r = sim->pmap[ry][rx]; - if (!r && !sim->bmap[(ry)/CELL][(rx)/CELL] && ry > CELL && rx > CELL && ry < YRES-CELL && rx < XRES-CELL) + if ((!r || ((r&0xFF) == PT_SWCH && sim->parts[r>>8].life >= 10)) && !sim->bmap[(ry)/CELL][(rx)/CELL] && ry > CELL && rx > CELL && ry < YRES-CELL && rx < XRES-CELL) { count++; for (tx = rx - tron_ry[dir] , ty = ry - tron_rx[dir], j=1; abs(tx-rx) < (len-k) && abs(ty-ry) < (len-k); tx-=tron_ry[dir],ty-=tron_rx[dir],j++) { r = sim->pmap[ty][tx]; - if (!r && !sim->bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL) + if ((!r || ((r&0xFF) == PT_SWCH && sim->parts[r>>8].life >= 10)) && !sim->bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL) { if (j == (len-k))//there is a safe path, so we can break out return len+1; @@ -217,7 +217,7 @@ int Element_TRON::trymovetron(Simulation * sim, int x, int y, int dir, int i, in for (tx = rx + tron_ry[dir] , ty = ry + tron_rx[dir], j=1; abs(tx-rx) < (len-k) && abs(ty-ry) < (len-k); tx+=tron_ry[dir],ty+=tron_rx[dir],j++) { r = sim->pmap[ty][tx]; - if (!r && !sim->bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL) + if ((!r || ((r&0xFF) == PT_SWCH && sim->parts[r>>8].life >= 10)) && !sim->bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL) { if (j == (len-k)) return len+1; |
