From 313c2661aff96e407baae06cfb3a2f67f43ecdf8 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 3 Apr 2020 17:06:07 -0700 Subject: [PATCH] Fix nested if-statements relating to blocks in Entity.cpp Just like earlier, these are of the form if (cond1) { if (cond2) { if (cond3) { thing; } } } and are really annoying to read. Also this removes the remnants of the 'active' system that have been replaced with 'if (true)' conditionals in order to not add noise to the diff. --- desktop_version/src/Entity.cpp | 92 +++++++++++----------------------- 1 file changed, 28 insertions(+), 64 deletions(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index 5f74372c..849a8237 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -1090,12 +1090,9 @@ void entityclass::removetrigger( int t ) { for(size_t i=0; i 0 && blocks[i].trigger == 0) if (help.intersects(blocks[i].rect, temprect)) return true; - if (dy <= 0 && blocks[i].trigger == 1) if (help.intersects(blocks[i].rect, temprect)) return true; - if (dx > 0 && blocks[i].trigger == 2) if (help.intersects(blocks[i].rect, temprect)) return true; - if (dx <= 0 && blocks[i].trigger == 3) if (help.intersects(blocks[i].rect, temprect)) return true; - } - } - if (blocks[i].type == BLOCK) - { - if (help.intersects(blocks[i].rect, temprect)) - { - return true; - } - } - if (blocks[i].type == SAFE) - { - if( (dr)==1) - { - if (help.intersects(blocks[i].rect, temprect)) - { - return true; - } - } - } + if (dy > 0 && blocks[i].trigger == 0) if (help.intersects(blocks[i].rect, temprect)) return true; + if (dy <= 0 && blocks[i].trigger == 1) if (help.intersects(blocks[i].rect, temprect)) return true; + if (dx > 0 && blocks[i].trigger == 2) if (help.intersects(blocks[i].rect, temprect)) return true; + if (dx <= 0 && blocks[i].trigger == 3) if (help.intersects(blocks[i].rect, temprect)) return true; + } + if (blocks[i].type == BLOCK && help.intersects(blocks[i].rect, temprect)) + { + return true; + } + if (blocks[i].type == SAFE && (dr)==1 && help.intersects(blocks[i].rect, temprect)) + { + return true; } } return false;