Permalink
Browse files

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

  • Loading branch information...
My main account authored and jacob1 committed Jul 1, 2017
1 parent d0feba6 commit 284e653aa5a968c459e099a628fd5a2f3f09888b
Showing with 17 additions and 18 deletions.
  1. +17 −18 src/simulation/Simulation.cpp
@@ -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])
elementCount[parts[i].type]--;
if (parts[i].type == PT_STKM)
switch (parts[i].type)
{
case PT_STKM:
player.spwn = 0;
}
else if (parts[i].type == PT_STKM2)
{
break;
case PT_STKM2:
player2.spwn = 0;
}
else if (parts[i].type == PT_SPAWN)
{
break;
case PT_SPAWN:
if (player.spawnID == i)
player.spawnID = -1;
}
else if (parts[i].type == PT_SPAWN2)
{
break;
case PT_SPAWN2:
if (player2.spawnID == i)
player2.spawnID = -1;
}
else if (parts[i].type == PT_FIGH)
{
break;
case PT_FIGH:
fighters[(unsigned char)parts[i].tmp].spwn = 0;
fighcount--;
}
else if (parts[i].type == PT_SOAP)
{
break;
case PT_SOAP:
Element_SOAP::detach(this, i);
break;
case PT_ETRD:
if (parts[i].life == 0)
etrd_life0_count--;
break;
}
else if (parts[i].type == PT_ETRD && parts[i].life == 0)
etrd_life0_count--;
parts[i].type = PT_NONE;
parts[i].life = pfree;

0 comments on commit 284e653

Please sign in to comment.