summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-17 16:20:48 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-17 16:20:48 (GMT)
commit8ea1e41d8737cbd2cc5f7ca6779cc0a8031dac85 (patch)
tree79deff97e42cc30fb6952729a666011002bb10fb /src
parenta3e97d51d13cd0aa4e484b374aabf52e08d70037 (diff)
downloadpowder-8ea1e41d8737cbd2cc5f7ca6779cc0a8031dac85.zip
powder-8ea1e41d8737cbd2cc5f7ca6779cc0a8031dac85.tar.gz
TPT: Fix switch not activating completely while being sparked 1a5cd45eb8
Diffstat (limited to 'src')
-rw-r--r--src/elements/swch.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/elements/swch.cpp b/src/elements/swch.cpp
index f37192b..4adc270 100644
--- a/src/elements/swch.cpp
+++ b/src/elements/swch.cpp
@@ -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) {
sim->part_change_type(i,x,y,PT_SPRK);