summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-12-18 19:55:10 (GMT)
committer jacob1 <jfu614@gmail.com>2012-12-18 19:55:10 (GMT)
commitb236c75209c45bddf51f6911593d27779dd621e2 (patch)
treeeb73becb499ecbedad620669840b357a8583e154 /src/simulation
parent771d71ea4619f30bd1b135697e83037ba333008f (diff)
downloadpowder-b236c75209c45bddf51f6911593d27779dd621e2.zip
powder-b236c75209c45bddf51f6911593d27779dd621e2.tar.gz
make TSNS not detect METL, some other sensor and CONV fixes
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Simulation.cpp22
-rw-r--r--src/simulation/elements/CONV.cpp2
-rw-r--r--src/simulation/elements/DTEC.cpp8
-rw-r--r--src/simulation/elements/TSNS.cpp4
4 files changed, 14 insertions, 22 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 1ac5d48..1e5fbb9 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -2801,24 +2801,22 @@ int Simulation::create_part(int p, int x, int y, int tv)
{
if (pmap[y][x])
{
+ int drawOn = pmap[y][x]&0xFF;
if ((
- ((pmap[y][x]&0xFF)==PT_STOR&&!(elements[t].Properties&TYPE_SOLID))||
- (pmap[y][x]&0xFF)==PT_CLNE||
- (pmap[y][x]&0xFF)==PT_BCLN||
- (pmap[y][x]&0xFF)==PT_CONV||
- ((pmap[y][x]&0xFF)==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN)||
- ((pmap[y][x]&0xFF)==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN)
+ (drawOn == PT_STOR && !(elements[t].Properties&TYPE_SOLID)) ||
+ drawOn==PT_CLNE ||
+ drawOn==PT_BCLN ||
+ drawOn==PT_CONV ||
+ (drawOn==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN) ||
+ (drawOn==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN)
)&&(
- t!=PT_CLNE&&t!=PT_PCLN&&
- t!=PT_BCLN&&t!=PT_STKM&&
- t!=PT_STKM2&&t!=PT_PBCN&&
- t!=PT_STOR&&t!=PT_FIGH)
+ t != PT_CLNE && t != PT_PCLN && t != PT_BCLN && t != PT_STKM && t != PT_STKM2 && t != PT_PBCN && t != PT_STOR && t != PT_FIGH && t != PT_CONV)
)
{
parts[pmap[y][x]>>8].ctype = t;
- if (t==PT_LIFE && v<NGOLALT && (pmap[y][x]&0xFF)!=PT_STOR) parts[pmap[y][x]>>8].tmp = v;
+ if (t == PT_LIFE && v < NGOLALT && drawOn != PT_STOR) parts[pmap[y][x]>>8].tmp = v;
}
- else if ((pmap[y][x]&0xFF) == PT_DTEC && (pmap[y][x]&0xFF) != t)
+ else if (drawOn == PT_DTEC && drawOn != t)
{
parts[pmap[y][x]>>8].ctype = t;
if (t==PT_LIFE && v<NGOLALT)
diff --git a/src/simulation/elements/CONV.cpp b/src/simulation/elements/CONV.cpp
index 6ad1336..6577516 100644
--- a/src/simulation/elements/CONV.cpp
+++ b/src/simulation/elements/CONV.cpp
@@ -28,7 +28,7 @@ Element_CONV::Element_CONV()
Temperature = R_TEMP+0.0f +273.15f;
HeatConduct = 251;
- Description = "Solid. Converts whatever touches it into its ctype.";
+ Description = "Solid. Converts everything into whatever it first touches.";
State = ST_NONE;
Properties = TYPE_SOLID;
diff --git a/src/simulation/elements/DTEC.cpp b/src/simulation/elements/DTEC.cpp
index 6d67cf2..803e413 100644
--- a/src/simulation/elements/DTEC.cpp
+++ b/src/simulation/elements/DTEC.cpp
@@ -46,12 +46,6 @@ Element_DTEC::Element_DTEC()
}
-//#TPT-Directive ElementHeader Element_DTEC static int in_radius(int rd, int x, int y)
-int Element_DTEC::in_radius(int rd, int x, int y)
-{
- return (pow((double)x,2)*pow((double)rd,2)+pow((double)y,2)*pow((double)rd,2)<=pow((double)rd,2)*pow((double)rd,2));
-}
-
//#TPT-Directive ElementHeader Element_DTEC static int update(UPDATE_FUNC_ARGS)
int Element_DTEC::update(UPDATE_FUNC_ARGS)
{
@@ -70,7 +64,7 @@ int Element_DTEC::update(UPDATE_FUNC_ARGS)
rt = parts[r>>8].type;
if (sim->parts_avg(i,r>>8,PT_INSL) != PT_INSL)
{
- if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && in_radius(rd, rx, ry))
+ if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0)
{
parts[r>>8].life = 4;
parts[r>>8].ctype = rt;
diff --git a/src/simulation/elements/TSNS.cpp b/src/simulation/elements/TSNS.cpp
index d5c8aa7..a4abbaf 100644
--- a/src/simulation/elements/TSNS.cpp
+++ b/src/simulation/elements/TSNS.cpp
@@ -64,7 +64,7 @@ int Element_TSNS::update(UPDATE_FUNC_ARGS)
rt = parts[r>>8].type;
if (sim->parts_avg(i,r>>8,PT_INSL) != PT_INSL)
{
- if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && Element_DTEC::in_radius(rd, rx, ry))
+ if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0)
{
parts[r>>8].life = 4;
parts[r>>8].ctype = rt;
@@ -82,7 +82,7 @@ int Element_TSNS::update(UPDATE_FUNC_ARGS)
r = sim->photons[y+ry][x+rx];
if(!r)
continue;
- if (parts[r>>8].temp > parts[i].temp && parts[r>>8].type != PT_TSNS)
+ if (parts[r>>8].temp > parts[i].temp && parts[r>>8].type != PT_TSNS && parts[i].type != PT_METL)
parts[i].life = 1;
}
return 0;