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.
master
Nicolas Hake 2018-12-31 13:53:56 +01:00
parent 7cd79b1eaa
commit dca6d2caaf
1 changed files with 10 additions and 8 deletions

View File

@ -3227,6 +3227,7 @@ bool C4Landscape::FindMatPathPush(int32_t &fx, int32_t &fy, int32_t mdens, int32
// Try to find a way out // Try to find a way out
int i = 1; int i = 1;
for (; i < iPushRange; i++) for (; i < iPushRange; i++)
{
if (GetDensity(x - i, y) <= mdens) if (GetDensity(x - i, y) <= mdens)
{ {
x -= i; dir = R; break; 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; y += i; dir = U; break;
} }
// Not found? }
if (i >= iPushRange) return false; // Not found?
// Done? if (i >= iPushRange) return false;
if (GetDensity(x, y) < mdens) // Done?
{ if (GetDensity(x, y) < mdens)
fx = x; fy = y; {
return true; fx = x; fy = y;
} return true;
}
} }
// Save startpoint of search // Save startpoint of search
int32_t sx = x, sy = y, sdir = dir; int32_t sx = x, sy = y, sdir = dir;