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
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;