summaryrefslogtreecommitdiff
path: root/src/simulation/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-12 16:31:32 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-12 16:31:32 (GMT)
commit6af88ee7daaa3bbfd11a468fff15847068220000 (patch)
treeeae0b04df2817a408759462bbce92712725460cd /src/simulation/elements
parent20e85066dcf9769fabaf525ba0123fe0f1d1078c (diff)
downloadpowder-6af88ee7daaa3bbfd11a468fff15847068220000.zip
powder-6af88ee7daaa3bbfd11a468fff15847068220000.tar.gz
TPT: Change pipe and portal to check element type using properties instead of falldown and state 11bd67eb61
Diffstat (limited to 'src/simulation/elements')
-rw-r--r--src/simulation/elements/PIPE.cpp6
-rw-r--r--src/simulation/elements/PRTI.cpp6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/simulation/elements/PIPE.cpp b/src/simulation/elements/PIPE.cpp
index 216d3d7..2370b05 100644
--- a/src/simulation/elements/PIPE.cpp
+++ b/src/simulation/elements/PIPE.cpp
@@ -129,7 +129,7 @@ int Element_PIPE::update(UPDATE_FUNC_ARGS)
}
}
//try eating particle at entrance
- else if ((parts[i].tmp&0xFF) == 0 && (sim->elements[r&0xFF].Falldown!= 0 || sim->elements[r&0xFF].State == ST_GAS))
+ else if ((parts[i].tmp&0xFF) == 0 && (sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)))
{
if ((r&0xFF)==PT_SOAP)
sim->detach(r>>8);
@@ -140,7 +140,7 @@ int Element_PIPE::update(UPDATE_FUNC_ARGS)
parts[i].pavg[1] = parts[r>>8].ctype;
sim->kill_part(r>>8);
}
- else if ((parts[i].tmp&0xFF) == 0 && (r&0xFF)==PT_STOR && parts[r>>8].tmp && (sim->elements[parts[r>>8].tmp].Falldown!= 0 || sim->elements[parts[r>>8].tmp].State == ST_GAS))
+ else if ((parts[i].tmp&0xFF) == 0 && (r&0xFF)==PT_STOR && parts[r>>8].tmp && (sim->elements[parts[r>>8].tmp].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)))
{
parts[i].tmp = parts[r>>8].tmp;
parts[i].temp = parts[r>>8].temp;
@@ -387,4 +387,4 @@ void Element_PIPE::pushParticle(Simulation * sim, int i, int count, int original
}
-Element_PIPE::~Element_PIPE() {} \ No newline at end of file
+Element_PIPE::~Element_PIPE() {}
diff --git a/src/simulation/elements/PRTI.cpp b/src/simulation/elements/PRTI.cpp
index 4d13bd1..451c54b 100644
--- a/src/simulation/elements/PRTI.cpp
+++ b/src/simulation/elements/PRTI.cpp
@@ -63,10 +63,10 @@ int Element_PRTI::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx];
if (!r)
fe = 1;
- if (!r || (r&0xFF)==PT_PRTI || (r&0xFF)==PT_PRTO || (sim->elements[r&0xFF].Falldown== 0 && sim->elements[r&0xFF].State != ST_GAS && (r&0xFF)!=PT_SPRK))
+ if (!r || (r&0xFF)==PT_PRTI || (r&0xFF)==PT_PRTO || (!(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) && (r&0xFF)!=PT_SPRK))
{
r = sim->photons[y+ry][x+rx];
- if (!r || (r&0xFF)==PT_PRTI || (r&0xFF)==PT_PRTO || (sim->elements[r&0xFF].Falldown== 0 && sim->elements[r&0xFF].State != ST_GAS && (r&0xFF)!=PT_SPRK))
+ if (!r || (r&0xFF)==PT_PRTI || (r&0xFF)==PT_PRTO || (!(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) && (r&0xFF)!=PT_SPRK))
continue;
}
@@ -136,4 +136,4 @@ int Element_PRTI::graphics(GRAPHICS_FUNC_ARGS)
}
-Element_PRTI::~Element_PRTI() {} \ No newline at end of file
+Element_PRTI::~Element_PRTI() {}