1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Condense some nested else-if statements

It's better to write 'else if' than 'else { if }'.
This commit is contained in:
Misa 2020-04-04 12:19:18 -07:00 committed by Ethan Lee
parent e6c6c7cf60
commit 7899cb8088

View file

@ -1044,15 +1044,12 @@ void gamelogic()
{
obj.entities[i].xp += 320;
}
else
{
if (obj.entities[i].xp > 310)
else if (obj.entities[i].xp > 310)
{
obj.entities[i].xp -= 320;
}
}
}
}
for (size_t i = 0; i < obj.entities.size(); i++)
{
@ -1064,16 +1061,13 @@ void gamelogic()
{
obj.entities[i].yp += 232;
}
else
{
if (obj.entities[i].yp > 226)
else if (obj.entities[i].yp > 226)
{
obj.entities[i].yp -= 232;
}
}
}
}
}
else if (map.warpx)
{
for (size_t i = 0; i < obj.entities.size(); i++)
@ -1088,30 +1082,24 @@ void gamelogic()
{
obj.entities[i].xp += 400;
}
else
{
if (obj.entities[i].xp > 320)
else if (obj.entities[i].xp > 320)
{
obj.entities[i].xp -= 400;
}
}
}
else
{
if (obj.entities[i].xp <= -10)
{
obj.entities[i].xp += 320;
}
else
{
if (obj.entities[i].xp > 310)
else if (obj.entities[i].xp > 310)
{
obj.entities[i].xp -= 320;
}
}
}
}
}
int player = obj.getplayer();
if (game.door_down > -2 && obj.entities[player].yp >= 238)
@ -1134,15 +1122,12 @@ void gamelogic()
{
obj.entities[i].yp += 232;
}
else
{
if (obj.entities[i].yp > 226)
else if (obj.entities[i].yp > 226)
{
obj.entities[i].yp -= 232;
}
}
}
}
for (size_t i = 0; i < obj.entities.size(); i++)
{
@ -1154,15 +1139,12 @@ void gamelogic()
{
obj.entities[i].xp += 350;
}
else
{
if (obj.entities[i].xp > 320)
else if (obj.entities[i].xp > 320)
{
obj.entities[i].xp -= 350;
}
}
}
}
int player = obj.getplayer();
if (game.door_left > -2 && obj.entities[player].xp < -14)