summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-10-12 18:47:46 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-10-26 14:12:13 (GMT)
commit947660fcd445be2e09fe52da912547a69c685ba7 (patch)
treeeefa62f38b206497b45d85ff5e888d4ed788c106
parentccd9284e61ee453e8f0541af671c3199548853a4 (diff)
downloadpowder-947660fcd445be2e09fe52da912547a69c685ba7.zip
powder-947660fcd445be2e09fe52da912547a69c685ba7.tar.gz
Fix hydrogen not burning right (with and without realistic heat), allow h2 to burn at all temps while still allowing fusion to work correctly
-rw-r--r--src/simulation/elements/CO2.cpp11
-rw-r--r--src/simulation/elements/FIRE.cpp6
-rw-r--r--src/simulation/elements/H2.cpp34
-rw-r--r--src/simulation/elements/NBLE.cpp25
-rw-r--r--src/simulation/elements/O2.cpp22
-rw-r--r--src/simulation/elements/SPRK.cpp2
6 files changed, 73 insertions, 27 deletions
diff --git a/src/simulation/elements/CO2.cpp b/src/simulation/elements/CO2.cpp
index ca5cc31..49614fb 100644
--- a/src/simulation/elements/CO2.cpp
+++ b/src/simulation/elements/CO2.cpp
@@ -85,8 +85,15 @@ int Element_CO2::update(UPDATE_FUNC_ARGS)
int j;
sim->create_part(i,x,y,PT_O2);
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = 15000;
- if (!(rand()%50)) { j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = 15000; }
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
+ if (j != -1)
+ parts[j].temp = 15000;
+ if (!(rand()%50))
+ {
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC);
+ if (j != -1)
+ parts[j].temp = 15000;
+ }
parts[i].temp = 15000;
sim->pv[y/CELL][x/CELL] += 100;
diff --git a/src/simulation/elements/FIRE.cpp b/src/simulation/elements/FIRE.cpp
index 0a98149..5345070 100644
--- a/src/simulation/elements/FIRE.cpp
+++ b/src/simulation/elements/FIRE.cpp
@@ -58,7 +58,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
}
if(t==PT_FIRE && parts[i].life <=1)
{
- if (parts[i].tmp==3){
+ if ((parts[i].tmp&0x3) == 3){
t = PT_DSTW;
sim->part_change_type(i,x,y,t);
parts[i].life = 0;
@@ -73,7 +73,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
}
if(t==PT_PLSM && parts[i].life <=1)
{
- if (parts[i].tmp==3){
+ if ((parts[i].tmp&0x3) == 3){
t = PT_DSTW;
sim->part_change_type(i,x,y,t);
parts[i].life = 0;
@@ -94,7 +94,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
(t!=PT_SPRK || (rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL)) &&
(t!=PT_PHOT || rt!=PT_INSL) &&
(rt!=PT_SPNG || parts[r>>8].life==0) &&
- (rt!=PT_H2 || (parts[r>>8].temp < 2273.15 && sim->pv[y/CELL][x/CELL] < 50.0f)) &&
+ (rt!=PT_H2 || (parts[r>>8].temp < 2273.15 && sim->pv[y/CELL][x/CELL] < 50.0f)) &&
sim->elements[rt].Flammable && (sim->elements[rt].Flammable + (int)(sim->pv[(y+ry)/CELL][(x+rx)/CELL]*10.0f))>(rand()%1000))
{
sim->part_change_type(r>>8,x+rx,y+ry,PT_FIRE);
diff --git a/src/simulation/elements/H2.cpp b/src/simulation/elements/H2.cpp
index 31e7d06..2b6c31b 100644
--- a/src/simulation/elements/H2.cpp
+++ b/src/simulation/elements/H2.cpp
@@ -48,11 +48,8 @@ Element_H2::Element_H2()
//#TPT-Directive ElementHeader Element_H2 static int update(UPDATE_FUNC_ARGS)
int Element_H2::update(UPDATE_FUNC_ARGS)
-
{
int r,rx,ry,rt;
- if (parts[i].temp > 2273.15 && sim->pv[y/CELL][x/CELL] > 50.0f)
- parts[i].tmp = 1;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -66,9 +63,9 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
sim->part_change_type(r>>8,x+rx,y+ry,PT_WATR);
sim->part_change_type(i,x,y,PT_OIL);
}
- if (parts[r>>8].temp > 2273.15)// && pv[y/CELL][x/CELL] > 50.0f)
+ if (parts[r>>8].temp > 2273.15 && sim->pv[y/CELL][x/CELL] > 45.0f)
continue;
- if (parts[i].temp < 2273.15)
+ if (sim->pv[y/CELL][x/CELL] <= 45.0f)
{
if (rt==PT_FIRE)
{
@@ -77,7 +74,7 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
parts[r>>8].temp=3473;
parts[r>>8].tmp |= 1;
}
- if (rt==PT_FIRE || rt==PT_PLSM || rt==PT_LAVA)
+ if (rt==PT_FIRE || (rt==PT_PLSM && !(parts[r>>8].tmp&4)) || (rt==PT_LAVA && parts[r>>8].ctype != PT_BMTL))
{
sim->create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()/(RAND_MAX/100));
@@ -93,11 +90,28 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
float temp = parts[i].temp;
sim->create_part(i,x,y,PT_NBLE);
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = temp;
- if (!(rand()%10)) { j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = temp; }
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); if (j != -1) { parts[j].ctype = 0x7C0000; parts[j].temp = temp; }
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
+ if (j != -1)
+ parts[j].temp = temp;
+ if (!(rand()%10))
+ {
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC);
+ if (j != -1)
+ parts[j].temp = temp;
+ }
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
+ if (j != -1)
+ {
+ parts[j].ctype = 0x7C0000;
+ parts[j].temp = temp;
+ }
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM); if (j != -1) parts[j].temp = temp;
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM);
+ if (j != -1)
+ {
+ parts[j].temp = temp;
+ parts[j].tmp |= 4;
+ }
parts[i].temp = temp+750+rand()%500;
sim->pv[y/CELL][x/CELL] += 30;
diff --git a/src/simulation/elements/NBLE.cpp b/src/simulation/elements/NBLE.cpp
index 973a134..3093d45 100644
--- a/src/simulation/elements/NBLE.cpp
+++ b/src/simulation/elements/NBLE.cpp
@@ -59,11 +59,28 @@ int Element_NBLE::update(UPDATE_FUNC_ARGS)
float temp = parts[i].temp;
sim->create_part(i,x,y,PT_CO2);
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = temp;
- if (!(rand()%25)) { j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = temp; }
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); if (j != -1) { parts[j].ctype = 0xF800000; parts[j].temp = temp; }
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
+ if (j != -1)
+ parts[j].temp = temp;
+ if (!(rand()%25))
+ {
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC);
+ if (j != -1)
+ parts[j].temp = temp;
+ }
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
+ if (j != -1)
+ {
+ parts[j].ctype = 0xF800000;
+ parts[j].temp = temp;
+ }
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM); if (j != -1) parts[j].temp = temp;
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM);
+ if (j != -1)
+ {
+ parts[j].temp = temp;
+ parts[j].tmp |= 4;
+ }
parts[i].temp = temp+1750+rand()%500;
sim->pv[y/CELL][x/CELL] += 50;
diff --git a/src/simulation/elements/O2.cpp b/src/simulation/elements/O2.cpp
index e4eefdf..20bd902 100644
--- a/src/simulation/elements/O2.cpp
+++ b/src/simulation/elements/O2.cpp
@@ -50,8 +50,6 @@ Element_O2::Element_O2()
int Element_O2::update(UPDATE_FUNC_ARGS)
{
int r,rx,ry;
- if (parts[i].temp < 9773.15)
- {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -67,7 +65,7 @@ int Element_O2::update(UPDATE_FUNC_ARGS)
parts[r>>8].temp=3473;
parts[r>>8].tmp |= 2;
}
- if ((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM)
+ if ((r&0xFF)==PT_FIRE || ((r&0xFF)==PT_PLSM && !(parts[r>>8].tmp&4)))
{
sim->create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()/(RAND_MAX/100));
@@ -75,17 +73,25 @@ int Element_O2::update(UPDATE_FUNC_ARGS)
}
}
- }
- else if (parts[i].temp > 9973.15 && sim->pv[y/CELL][x/CELL] > 250.0f && abs(sim->gravx[((y/CELL)*(XRES/CELL))+(x/CELL)]) + abs(sim->gravy[((y/CELL)*(XRES/CELL))+(x/CELL)]) > 20)
+ if (parts[i].temp > 9973.15 && sim->pv[y/CELL][x/CELL] > 250.0f && abs(sim->gravx[((y/CELL)*(XRES/CELL))+(x/CELL)]) + abs(sim->gravy[((y/CELL)*(XRES/CELL))+(x/CELL)]) > 20)
{
if (rand()%5 < 1)
{
int j;
sim->create_part(i,x,y,PT_BRMT);
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = 15000;
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); if (j != -1) parts[j].temp = 15000;
- j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM); if (j != -1) parts[j].temp = 15000;
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
+ if (j != -1)
+ parts[j].temp = 15000;
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
+ if (j != -1)
+ parts[j].temp = 15000;
+ j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM);
+ if (j != -1)
+ {
+ parts[j].temp = 15000;
+ parts[j].tmp |= 4;
+ }
parts[i].temp = 15000;
sim->pv[y/CELL][x/CELL] += 300;
diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp
index c2f5a38..09638ff 100644
--- a/src/simulation/elements/SPRK.cpp
+++ b/src/simulation/elements/SPRK.cpp
@@ -97,6 +97,8 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
parts[i].life = rand()%150+50;
sim->part_change_type(i,x,y,PT_PLSM);
parts[i].ctype = PT_NBLE;
+ if (parts[i].temp > 5273.15)
+ parts[i].tmp |= 4;
parts[i].temp = 3500;
sim->pv[y/CELL][x/CELL] += 1;
}