summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-10-29 09:36:32 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-10-29 09:36:32 (GMT)
commit48be91e4df50ecb5cc52e21556dce0df8474666e (patch)
tree9465115c666da9413fac882ec8b9b1813c5c83eb /src/simulation
parente08bc6680bb766305486fdbe1d8e6cb6482993af (diff)
parent32bdcb89e8609b43e24493d54c57d0fb552a5331 (diff)
downloadpowder-48be91e4df50ecb5cc52e21556dce0df8474666e.zip
powder-48be91e4df50ecb5cc52e21556dce0df8474666e.tar.gz
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Simulation.cpp18
-rw-r--r--src/simulation/elements/ELEC.cpp1
-rw-r--r--src/simulation/elements/SPNG.cpp4
-rw-r--r--src/simulation/elements/VIBR.cpp8
4 files changed, 24 insertions, 7 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 09b0da9..488c7fb 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -2017,6 +2017,7 @@ void Simulation::init_can_move()
//whol eats anar
can_move[PT_ANAR][PT_WHOL] = 1;
can_move[PT_ANAR][PT_NWHL] = 1;
+ can_move[PT_ELEC][PT_DEUT] = 1;
can_move[PT_THDR][PT_THDR] = 2;
can_move[PT_EMBR][PT_EMBR] = 2;
}
@@ -2185,6 +2186,11 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
if (temp_bin > 25) temp_bin = 25;
parts[i].ctype = 0x1F << temp_bin;
}
+ if (((r&0xFF)==PT_BIZR || (r&0xFF)==PT_BIZRG || (r&0xFF)==PT_BIZRS) && parts[i].type==PT_PHOT)
+ {
+ part_change_type(i, x, y, PT_ELEC);
+ parts[i].ctype = 0;
+ }
return 1;
}
//else e=1 , we are trying to swap the particles, return 0 no swap/move, 1 is still overlap/move, because the swap takes place later
@@ -2218,6 +2224,14 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
kill_part(i);
return 0;
}
+ if ((r&0xFF)==PT_DEUT && parts[i].type==PT_ELEC)
+ {
+ if(parts[r>>8].life < 6000)
+ parts[r>>8].life += 1;
+ parts[r>>8].temp = 0;
+ kill_part(i);
+ return 0;
+ }
if (parts[i].type==PT_CNCT && y<ny && (pmap[y+1][x]&0xFF)==PT_CNCT)//check below CNCT for another CNCT
return 0;
@@ -3687,7 +3701,9 @@ void Simulation::update_particles_i(int start, int inc)
rt = r&0xFF;
if (rt&&elements[rt].HeatConduct&&(rt!=PT_HSWC||parts[r>>8].life==10)
&&(t!=PT_FILT||(rt!=PT_BRAY&&rt!=PT_BIZR&&rt!=PT_BIZRG))
- &&(rt!=PT_FILT||(t!=PT_BRAY&&t!=PT_PHOT&&t!=PT_BIZR&&t!=PT_BIZRG)))
+ &&(rt!=PT_FILT||(t!=PT_BRAY&&t!=PT_PHOT&&t!=PT_BIZR&&t!=PT_BIZRG))
+ &&(t!=PT_ELEC||rt!=PT_DEUT)
+ &&(t!=PT_DEUT||rt!=PT_ELEC))
{
surround_hconduct[j] = r>>8;
#ifdef REALISTIC
diff --git a/src/simulation/elements/ELEC.cpp b/src/simulation/elements/ELEC.cpp
index e9d1f5a..c602da8 100644
--- a/src/simulation/elements/ELEC.cpp
+++ b/src/simulation/elements/ELEC.cpp
@@ -123,7 +123,6 @@ int Element_ELEC::update(UPDATE_FUNC_ARGS)
if(parts[r>>8].life < 6000)
parts[r>>8].life += 1;
parts[r>>8].temp = 0;
- parts[i].temp = 0;
sim->kill_part(i);
return 1;
}
diff --git a/src/simulation/elements/SPNG.cpp b/src/simulation/elements/SPNG.cpp
index 37f5a08..95dd12f 100644
--- a/src/simulation/elements/SPNG.cpp
+++ b/src/simulation/elements/SPNG.cpp
@@ -53,7 +53,7 @@ int Element_SPNG::update(UPDATE_FUNC_ARGS)
int limit = 50;
if (parts[i].life<limit && sim->pv[y/CELL][x/CELL]<=3&&sim->pv[y/CELL][x/CELL]>=-3&&parts[i].temp<=374.0f)
{
- int absorbChanceDenom = parts[i].life*1000/limit + 500;
+ int absorbChanceDenom = parts[i].life*10000/limit + 500;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -195,4 +195,4 @@ int Element_SPNG::graphics(GRAPHICS_FUNC_ARGS)
}
-Element_SPNG::~Element_SPNG() {} \ No newline at end of file
+Element_SPNG::~Element_SPNG() {}
diff --git a/src/simulation/elements/VIBR.cpp b/src/simulation/elements/VIBR.cpp
index 370c69f..02c97fa 100644
--- a/src/simulation/elements/VIBR.cpp
+++ b/src/simulation/elements/VIBR.cpp
@@ -161,11 +161,13 @@ int Element_VIBR::update(UPDATE_FUNC_ARGS) {
sim->pv[y/CELL][x/CELL]=200;
}
//Neighbor check loop
- for (rx=-2; rx<3; rx++)
- for (ry=-2; ry<3; ry++)
+ for (rx=-3; rx<4; rx++)
+ for (ry=-3; ry<4; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
+ if (!r || (r & (abs(rx) == 3 || abs(ry) == 3)) )
+ r = sim->photons[y+ry][x+rx];
if (!r)
continue;
//Melts into EXOT
@@ -229,4 +231,4 @@ int Element_VIBR::graphics(GRAPHICS_FUNC_ARGS)
return 0;
}
-Element_VIBR::~Element_VIBR() {} \ No newline at end of file
+Element_VIBR::~Element_VIBR() {}