Convert another if-elseif block to switch (#465)

This commit is contained in:
My main account
2017-07-01 08:01:12 +08:00
committed by jacob1
parent d0feba6445
commit 284e653aa5

View File

@@ -2784,35 +2784,34 @@ void Simulation::kill_part(int i)//kills particle number i
if(parts[i].type > 0 && parts[i].type < PT_NUM && elementCount[parts[i].type]) if(parts[i].type > 0 && parts[i].type < PT_NUM && elementCount[parts[i].type])
elementCount[parts[i].type]--; elementCount[parts[i].type]--;
if (parts[i].type == PT_STKM) switch (parts[i].type)
{ {
case PT_STKM:
player.spwn = 0; player.spwn = 0;
} break;
else if (parts[i].type == PT_STKM2) case PT_STKM2:
{
player2.spwn = 0; player2.spwn = 0;
} break;
else if (parts[i].type == PT_SPAWN) case PT_SPAWN:
{
if (player.spawnID == i) if (player.spawnID == i)
player.spawnID = -1; player.spawnID = -1;
} break;
else if (parts[i].type == PT_SPAWN2) case PT_SPAWN2:
{
if (player2.spawnID == i) if (player2.spawnID == i)
player2.spawnID = -1; player2.spawnID = -1;
} break;
else if (parts[i].type == PT_FIGH) case PT_FIGH:
{
fighters[(unsigned char)parts[i].tmp].spwn = 0; fighters[(unsigned char)parts[i].tmp].spwn = 0;
fighcount--; fighcount--;
} break;
else if (parts[i].type == PT_SOAP) case PT_SOAP:
{
Element_SOAP::detach(this, i); Element_SOAP::detach(this, i);
} break;
else if (parts[i].type == PT_ETRD && parts[i].life == 0) case PT_ETRD:
if (parts[i].life == 0)
etrd_life0_count--; etrd_life0_count--;
break;
}
parts[i].type = PT_NONE; parts[i].type = PT_NONE;
parts[i].life = pfree; parts[i].life = pfree;