From 265d4f9dc48aa803cae351651dfb44e71e664e88 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 30 Aug 2024 11:23:55 -0700 Subject: [PATCH] Refactor: Unindent horizontal line code This removes unnecessary indentation in the code responsible for acting on a horizontal gravity line collision. The "meat" of the code is now no longer pushed to the right, as it should be. --- desktop_version/src/Entity.cpp | 44 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index f2f21e4a..f82dcc14 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -4852,30 +4852,32 @@ void entityclass::collisioncheck(int i, int j, bool scm /*= false*/) } break; case 4: //Person vs horizontal line! - if(game.deathseq==-1) + { + const bool collision = + game.deathseq == -1 + && entities[j].onentity > 0 + && entityhlinecollide(i, j); + if (!collision) { - if (entities[j].onentity > 0) - { - if (entityhlinecollide(i, j)) - { - music.playef(Sound_GRAVITYLINE); - game.gravitycontrol = (game.gravitycontrol + 1) % 2; - game.totalflips++; - if (game.gravitycontrol == 0) - { - if (entities[i].vy < 1) entities[i].vy = 1; - } - else - { - if (entities[i].vy > -1) entities[i].vy = -1; - } - - entities[j].state = entities[j].onentity; - entities[j].life = 6; - } - } + break; } + + music.playef(Sound_GRAVITYLINE); + game.gravitycontrol = (game.gravitycontrol + 1) % 2; + game.totalflips++; + if (game.gravitycontrol == 0) + { + if (entities[i].vy < 1) entities[i].vy = 1; + } + else + { + if (entities[i].vy > -1) entities[i].vy = -1; + } + + entities[j].state = entities[j].onentity; + entities[j].life = 6; break; + } case 5: //Person vs vertical gravity/warp line! if(game.deathseq==-1) {