From dca6d2caafc300ad699ecacf957eb14df17a7d4b Mon Sep 17 00:00:00 2001 From: Nicolas Hake Date: Mon, 31 Dec 2018 13:53:56 +0100 Subject: [PATCH] C4Landscape: Correct really badly misleading indentation Some code here was indented like it still belonged to the loop above, but never did, and was never intended to. This is an excellent argument for why braces are good, especially for statements which span more than one line. --- src/landscape/C4Landscape.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/landscape/C4Landscape.cpp b/src/landscape/C4Landscape.cpp index 4d2fde9cb..5115e453e 100644 --- a/src/landscape/C4Landscape.cpp +++ b/src/landscape/C4Landscape.cpp @@ -3227,6 +3227,7 @@ bool C4Landscape::FindMatPathPush(int32_t &fx, int32_t &fy, int32_t mdens, int32 // Try to find a way out int i = 1; for (; i < iPushRange; i++) + { if (GetDensity(x - i, y) <= mdens) { x -= i; dir = R; break; @@ -3243,14 +3244,15 @@ bool C4Landscape::FindMatPathPush(int32_t &fx, int32_t &fy, int32_t mdens, int32 { y += i; dir = U; break; } - // Not found? - if (i >= iPushRange) return false; - // Done? - if (GetDensity(x, y) < mdens) - { - fx = x; fy = y; - return true; - } + } + // Not found? + if (i >= iPushRange) return false; + // Done? + if (GetDensity(x, y) < mdens) + { + fx = x; fy = y; + return true; + } } // Save startpoint of search int32_t sx = x, sy = y, sdir = dir;