Skip to content

Commit

Permalink
fix SOAP changing the .tmp/.tmp2 of particles it thinks it's attached to
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Apr 17, 2014
1 parent 4b52209 commit 68e4c63
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/simulation/elements/SOAP.cpp
Expand Up @@ -88,10 +88,11 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
{
if (parts[i].life<=0)
{
//if only connected on one side
if ((parts[i].ctype&6) != 6 && (parts[i].ctype&6))
{
int target;
target = i;
int target = i;
//break entire bubble in a loop
while((parts[target].ctype&6) != 6 && (parts[target].ctype&6))
{
if (parts[target].ctype&2)
Expand Down Expand Up @@ -151,18 +152,21 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
{
if (parts[r>>8].ctype == 1)
{
int buf;
buf = parts[i].tmp;
int buf = parts[i].tmp;

parts[i].tmp = r>>8;
parts[buf].tmp2 = r>>8;
if (parts[buf].type == PT_SOAP)
parts[buf].tmp2 = r>>8;
parts[r>>8].tmp2 = i;
parts[r>>8].tmp = buf;
parts[r>>8].ctype = 7;
}
else if (parts[r>>8].ctype == 7 && parts[i].tmp != r>>8 && parts[i].tmp2 != r>>8)
{
parts[parts[i].tmp].tmp2 = parts[r>>8].tmp2;
parts[parts[r>>8].tmp2].tmp = parts[i].tmp;
if (parts[parts[i].tmp].type == PT_SOAP)
parts[parts[i].tmp].tmp2 = parts[r>>8].tmp2;
if (parts[parts[r>>8].tmp2].type == PT_SOAP)
parts[parts[r>>8].tmp2].tmp = parts[i].tmp;
parts[r>>8].tmp2 = i;
parts[i].tmp = r>>8;
}
Expand Down

0 comments on commit 68e4c63

Please sign in to comment.