From e4686724ac4203568b82002bc849df55c9205f8c Mon Sep 17 00:00:00 2001 From: Jacob1 Date: Thu, 5 Apr 2012 19:31:52 -0400 Subject: [PATCH] limit amount of ELEC produced to prevent infinite reactions --- src/elements/O2.c | 2 +- src/elements/co2.c | 2 +- src/elements/h2.c | 2 +- src/elements/nble.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/elements/O2.c b/src/elements/O2.c index 737b571ad..515247867 100644 --- a/src/elements/O2.c +++ b/src/elements/O2.c @@ -18,7 +18,7 @@ int update_O2(UPDATE_FUNC_ARGS) { int r,rx,ry; - if (parts[i].temp < 9773.15) + if (parts[i].temp < 9273.15) { for (rx=-2; rx<3; rx++) for (ry=-2; ry<3; ry++) diff --git a/src/elements/co2.c b/src/elements/co2.c index 3f7328825..acdbc9919 100644 --- a/src/elements/co2.c +++ b/src/elements/co2.c @@ -49,7 +49,7 @@ int update_CO2(UPDATE_FUNC_ARGS) { int j; kill_part(i); j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = 15000; - j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = 15000; + if (!(rand()%50)) { j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = 15000; } j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_O2); if (j != -1) parts[j].temp = 15000; if (rand()%1000 < 1) { j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_SING); if (j != -1) { parts[j].temp = 15000; parts[i].life = 3; } } diff --git a/src/elements/h2.c b/src/elements/h2.c index d03cd5062..86c3be3dc 100644 --- a/src/elements/h2.c +++ b/src/elements/h2.c @@ -61,7 +61,7 @@ int update_H2(UPDATE_FUNC_ARGS) part_change_type(i,x,y,PT_PLSM); parts[i].life = rand()%150+50; j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = temp; - j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = temp; + if (!(rand()%10)) { j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = temp; } j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); if (j != -1) { parts[j].ctype = 0xFFFF00; parts[j].temp = temp; } diff --git a/src/elements/nble.c b/src/elements/nble.c index dea5787b6..0c118ede2 100644 --- a/src/elements/nble.c +++ b/src/elements/nble.c @@ -26,7 +26,7 @@ int update_NBLE(UPDATE_FUNC_ARGS) part_change_type(i,x,y,PT_PLSM); parts[i].life = rand()%150+50; j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = temp; - j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = temp; + if (!(rand()%25)) { j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = temp; } j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); if (j != -1) { parts[j].ctype = 0xFF0000; parts[j].temp = temp; }