summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2012-01-25 20:27:26 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-02-05 14:45:30 (GMT)
commit1a5cd45eb8949fd8e81019337e4a92278e83d19b (patch)
tree7f07b1648cb2fb99c433fe2aaa237f808e8807f9 /src/elements
parent24335704b5d0a84cd53813c24f35e3c51eaf1f66 (diff)
downloadpowder-1a5cd45eb8949fd8e81019337e4a92278e83d19b.zip
powder-1a5cd45eb8949fd8e81019337e4a92278e83d19b.tar.gz
Fix switch not activating completely while being sparked
Check life>=10 so that activation still spreads just after the switch has been sparked. Copy other particle's life value instead of setting to 10 to avoid spark loops.
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/swch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/elements/swch.c b/src/elements/swch.c
index b88983b..08a372a 100644
--- a/src/elements/swch.c
+++ b/src/elements/swch.c
@@ -17,8 +17,11 @@ int update_SWCH(UPDATE_FUNC_ARGS) {
{
if (parts[i].life>=10&&parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9;
- else if (parts[i].life==0&&parts[r>>8].life==10)
- parts[i].life = 10;
+ else if (parts[i].life==0&&parts[r>>8].life>=10)
+ {
+ //Set to other particle's life instead of 10, otherwise spark loops form when SWCH is sparked while turning on
+ parts[i].life = parts[r>>8].life;
+ }
}
else if (rt==PT_SPRK&&parts[i].life==10&&parts[r>>8].ctype!=PT_PSCN&&parts[r>>8].ctype!=PT_NSCN) {
part_change_type(i,x,y,PT_SPRK);