summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-10-10 22:58:50 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-10-10 22:58:50 (GMT)
commit40457bf65218bd6d4aee0e377460d6cc6e61ee97 (patch)
tree0dc3e7edb9ed0be058d8711987226adfcc50ba82 /src/elements
parenta87407f0dfda733441d74c2edb25852ec7b3ef4c (diff)
downloadpowder-40457bf65218bd6d4aee0e377460d6cc6e61ee97.zip
powder-40457bf65218bd6d4aee0e377460d6cc6e61ee97.tar.gz
Fix crash with LIGH
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/sprk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/elements/sprk.c b/src/elements/sprk.c
index 45b9acb..ac86467 100644
--- a/src/elements/sprk.c
+++ b/src/elements/sprk.c
@@ -68,7 +68,9 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
int p=create_part(-1, x+rx*2, y+ry*2, PT_LIGH);
if (p!=-1)
{
- parts[p].life=rand()%(2+parts[i].tmp/15)+4+parts[i].tmp/7;
+ if(!parts[i].tmp) //Prevent Arithmetic errors with zero values
+ continue;
+ parts[p].life=rand()%(2+parts[i].tmp/15)+4+parts[i].tmp/7;
if (parts[i].life>60)
parts[i].life=60;
parts[p].temp=parts[p].life*parts[i].tmp/2.5;