diff options
| author | jacob1 <jfu614@gmail.com> | 2013-05-20 15:26:51 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-05-20 15:26:51 (GMT) |
| commit | 826b966668fe37d836de91cf29a6db0d1afee1f4 (patch) | |
| tree | f617c944418a227769408b75b075d334df93417c /src/simulation/elements/COAL.cpp | |
| parent | 77bf649fb4482c86ac1fd9b3233f062b53226007 (diff) | |
| download | powder-826b966668fe37d836de91cf29a6db0d1afee1f4.zip powder-826b966668fe37d836de91cf29a6db0d1afee1f4.tar.gz | |
reduce rand() chances to 5x the old values in elements that were changed to 3x3 loop checks instead of 5x5. Also some other fixes I found when looking at what had been changed.
Diffstat (limited to 'src/simulation/elements/COAL.cpp')
| -rw-r--r-- | src/simulation/elements/COAL.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/simulation/elements/COAL.cpp b/src/simulation/elements/COAL.cpp index 3186167..b2cc89c 100644 --- a/src/simulation/elements/COAL.cpp +++ b/src/simulation/elements/COAL.cpp @@ -49,7 +49,7 @@ Element_COAL::Element_COAL() //#TPT-Directive ElementHeader Element_COAL static int update(UPDATE_FUNC_ARGS) int Element_COAL::update(UPDATE_FUNC_ARGS) { - int r, rx, ry, trade, temp; + int r, rx, ry, trade, temp, t = parts[i].type; if (parts[i].life<=0) { sim->create_part(i, x, y, PT_FIRE); return 1; @@ -57,13 +57,16 @@ int Element_COAL::update(UPDATE_FUNC_ARGS) parts[i].life--; sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); } - if ((sim->pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40) - parts[i].tmp=39; - else if (parts[i].tmp<40&&parts[i].tmp>0) - parts[i].tmp--; - else if (parts[i].tmp<=0) { - sim->create_part(i, x, y, PT_BCOL); - return 1; + if (t == PT_COAL) + { + if ((sim->pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40) + parts[i].tmp=39; + else if (parts[i].tmp<40&&parts[i].tmp>0) + parts[i].tmp--; + else if (parts[i].tmp<=0) { + sim->create_part(i, x, y, PT_BCOL); + return 1; + } } /*if(100-parts[i].life > parts[i].tmp2) parts[i].tmp2 = 100-parts[i].life; |
