1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-22 08:49:46 +01:00

Use case-switch for warp line creation

No need to repeat the left part of a conditional if we can just use
case-switches instead.
This commit is contained in:
Misa 2020-07-09 03:14:17 -07:00 committed by Ethan Lee
parent c7ea684c08
commit f8e23119bf

View file

@ -1806,14 +1806,20 @@ void mapclass::loadlevel(int rx, int ry)
break; break;
case 50: //Warp Lines case 50: //Warp Lines
obj.customwarpmode=true; obj.customwarpmode=true;
if(ent.p1==0){ // switch (ent.p1)
{
case 0: //
obj.createentity(ex + 4, ent.p2 * 8, 51, ent.p3); obj.createentity(ex + 4, ent.p2 * 8, 51, ent.p3);
}else if(ent.p1==1){ //Horizontal, right break;
case 1: //Horizontal, right
obj.createentity(ex + 4, ent.p2 * 8, 52, ent.p3); obj.createentity(ex + 4, ent.p2 * 8, 52, ent.p3);
}else if(ent.p1==2){ //Vertical, top break;
case 2: //Vertical, top
obj.createentity(ent.p2 * 8, ey + 7, 53, ent.p3); obj.createentity(ent.p2 * 8, ey + 7, 53, ent.p3);
}else if(ent.p1==3){ break;
case 3:
obj.createentity(ent.p2 * 8, ey, 54, ent.p3); obj.createentity(ent.p2 * 8, ey, 54, ent.p3);
break;
} }
break; break;
} }