summaryrefslogtreecommitdiff
path: root/src/simulation/elements/BANG.cpp
diff options
context:
space:
mode:
authorcracker64 <cracker642@gmail.com>2013-02-26 23:59:37 (GMT)
committer cracker64 <cracker642@gmail.com>2013-02-26 23:59:37 (GMT)
commit8250515e97db5ace3e87c612d855f09235b73969 (patch)
treeddbc36591a9043334b2fc684722ffd334894da83 /src/simulation/elements/BANG.cpp
parente700ff29883fcc3479ad8d9fce9805fbb0d31dfa (diff)
downloadpowder-8250515e97db5ace3e87c612d855f09235b73969.zip
powder-8250515e97db5ace3e87c612d855f09235b73969.tar.gz
Lots of small optimizations and things, nothing should be functionally different.
Only gotten through a few elements, more later.
Diffstat (limited to 'src/simulation/elements/BANG.cpp')
-rw-r--r--src/simulation/elements/BANG.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/simulation/elements/BANG.cpp b/src/simulation/elements/BANG.cpp
index 8922e0e..9d9bfbb 100644
--- a/src/simulation/elements/BANG.cpp
+++ b/src/simulation/elements/BANG.cpp
@@ -62,11 +62,7 @@ int Element_BANG::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM)
- {
- parts[i].tmp = 1;
- }
- else if ((r&0xFF)==PT_SPRK || (r&0xFF)==PT_LIGH)
+ if ((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_SPRK || (r&0xFF)==PT_LIGH)
{
parts[i].tmp = 1;
}
@@ -86,9 +82,9 @@ int Element_BANG::update(UPDATE_FUNC_ARGS)
{
parts[i].tmp = 3;
}
- else if(parts[i].tmp>=3)
+ else
{
- float otemp = parts[i].temp-275.13f;
+ float otemp = parts[i].temp-273.15f;
//Explode!!
sim->pv[y/CELL][x/CELL] += 0.5f;
parts[i].tmp = 0;
@@ -97,14 +93,13 @@ int Element_BANG::update(UPDATE_FUNC_ARGS)
if(!(rand()%2))
{
sim->create_part(i, x, y, PT_FIRE);
- parts[i].temp = restrict_flt((MAX_TEMP/4)+otemp, MIN_TEMP, MAX_TEMP);
}
else
{
sim->create_part(i, x, y, PT_SMKE);
parts[i].life = rand()%50+500;
- parts[i].temp = restrict_flt((MAX_TEMP/4)+otemp, MIN_TEMP, MAX_TEMP);
}
+ parts[i].temp = restrict_flt((MAX_TEMP/4)+otemp, MIN_TEMP, MAX_TEMP);
}
else
{