From 1a5cd45eb8949fd8e81019337e4a92278e83d19b Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 26 Jan 2012 04:27:26 +0800 Subject: [PATCH] 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. --- src/elements/swch.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/elements/swch.c b/src/elements/swch.c index b88983b20..08a372aeb 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);