diff options
| author | cracker64 <cracker642@gmail.com> | 2013-02-27 05:11:23 (GMT) |
|---|---|---|
| committer | cracker64 <cracker642@gmail.com> | 2013-02-27 05:11:23 (GMT) |
| commit | 27e3e1251837f5d64e835068d5f5bd5b67b95921 (patch) | |
| tree | af6383f7df96485633c91ebcfbe6318ee927403f /src/simulation/elements/FSEP.cpp | |
| parent | a62467c74e9391dd2a9173cfa167d32eceed506b (diff) | |
| download | powder-27e3e1251837f5d64e835068d5f5bd5b67b95921.zip powder-27e3e1251837f5d64e835068d5f5bd5b67b95921.tar.gz | |
Small optimizations number 2.
Diffstat (limited to 'src/simulation/elements/FSEP.cpp')
| -rw-r--r-- | src/simulation/elements/FSEP.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/simulation/elements/FSEP.cpp b/src/simulation/elements/FSEP.cpp index 52e4a67..132e0de 100644 --- a/src/simulation/elements/FSEP.cpp +++ b/src/simulation/elements/FSEP.cpp @@ -55,11 +55,12 @@ int Element_FSEP::update(UPDATE_FUNC_ARGS) if (r!=-1) parts[r].life = 50; return 1; - } else if (parts[i].life < 40) { + } + else if (parts[i].life < 40) { parts[i].life--; - if ((rand()%10)==0) { - r = sim->create_part(-1, (rx=x+rand()%3-1), (ry=y+rand()%3-1), PT_PLSM); - if (r!=-1) + if (!(rand()%10)) { + r = sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_PLSM); + if (r>-1) parts[r].life = 50; } } @@ -71,11 +72,9 @@ int Element_FSEP::update(UPDATE_FUNC_ARGS) r = pmap[y+ry][x+rx]; if (!r) continue; - if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15)) + if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && parts[i].life>40 && !(rand()%15)) { - if (parts[i].life>40) { - parts[i].life = 39; - } + parts[i].life = 39; } } } @@ -83,4 +82,4 @@ int Element_FSEP::update(UPDATE_FUNC_ARGS) } -Element_FSEP::~Element_FSEP() {}
\ No newline at end of file +Element_FSEP::~Element_FSEP() {} |
