fix SOAP changing the .tmp/.tmp2 of particles it thinks it's attached to

This commit is contained in:
jacob1
2014-04-17 12:02:28 -04:00
parent 4b52209933
commit 68e4c638bf

View File

@@ -88,10 +88,11 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
{ {
if (parts[i].life<=0) if (parts[i].life<=0)
{ {
//if only connected on one side
if ((parts[i].ctype&6) != 6 && (parts[i].ctype&6)) if ((parts[i].ctype&6) != 6 && (parts[i].ctype&6))
{ {
int target; int target = i;
target = i; //break entire bubble in a loop
while((parts[target].ctype&6) != 6 && (parts[target].ctype&6)) while((parts[target].ctype&6) != 6 && (parts[target].ctype&6))
{ {
if (parts[target].ctype&2) if (parts[target].ctype&2)
@@ -151,18 +152,21 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
{ {
if (parts[r>>8].ctype == 1) if (parts[r>>8].ctype == 1)
{ {
int buf; int buf = parts[i].tmp;
buf = parts[i].tmp;
parts[i].tmp = r>>8; 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].tmp2 = i;
parts[r>>8].tmp = buf; parts[r>>8].tmp = buf;
parts[r>>8].ctype = 7; parts[r>>8].ctype = 7;
} }
else if (parts[r>>8].ctype == 7 && parts[i].tmp != r>>8 && parts[i].tmp2 != r>>8) 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; if (parts[parts[i].tmp].type == PT_SOAP)
parts[parts[r>>8].tmp2].tmp = parts[i].tmp; 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[r>>8].tmp2 = i;
parts[i].tmp = r>>8; parts[i].tmp = r>>8;
} }