diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-25 14:55:42 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-25 14:55:42 (GMT) |
| commit | 6dc7eaf43e75a88ebb17b2bf7929a4ebf1fbf8ba (patch) | |
| tree | 4bb1bbef03216b52fe783f60a61959727a5da736 /src/simulation/elements/CO2.cpp | |
| parent | 08d1dd06ed77970a4ad5fe1b1db7bfbf857f74d5 (diff) | |
| download | powder-6dc7eaf43e75a88ebb17b2bf7929a4ebf1fbf8ba.zip powder-6dc7eaf43e75a88ebb17b2bf7929a4ebf1fbf8ba.tar.gz | |
TPT: Prevent stacking from ELEC+NEUT, ELEC+water, and CO2 from BUBW ae5470ca78
Diffstat (limited to 'src/simulation/elements/CO2.cpp')
| -rw-r--r-- | src/simulation/elements/CO2.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/simulation/elements/CO2.cpp b/src/simulation/elements/CO2.cpp index e170938..745dedd 100644 --- a/src/simulation/elements/CO2.cpp +++ b/src/simulation/elements/CO2.cpp @@ -55,10 +55,10 @@ int Element_CO2::update(UPDATE_FUNC_ARGS) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) { r = pmap[y+ry][x+rx]; - if (20>(rand()%40000)&&parts[i].ctype==5) + if (parts[i].ctype==5 && 20>(rand()%40000)) { - parts[i].ctype = 0; - sim->create_part(-3, x, y, PT_WATR); + if (sim->create_part(-1, x+rx, y+ry, PT_WATR)>=0) + parts[i].ctype = 0; } if ((r>>8)>=NPART || !r) continue; @@ -72,7 +72,10 @@ int Element_CO2::update(UPDATE_FUNC_ARGS) if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%250)) { sim->part_change_type(i,x,y,PT_CBNW); - sim->kill_part(r>>8); + if (parts[i].ctype==5) //conserve number of water particles - ctype=5 means this CO2 hasn't released the water particle from BUBW yet + sim->create_part(r>>8, x+rx, y+ry, PT_CBNW); + else + sim->kill_part(r>>8); } } if (parts[i].temp > 9773.15 && sim->pv[y/CELL][x/CELL] > 200.0f) |
