summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuXarick <43006711+SamuXarick@users.noreply.github.com>2020-12-15 20:52:41 +0000
committerGitHub <noreply@github.com>2020-12-15 21:52:41 +0100
commit1d85d71d29b8d554e9304f3feb6c26f8b9faea82 (patch)
treeac51944674577d76f948027bd84d84d15f0d9499 /src
parente07afaeffb1da098dd8d623b5b66b339ee57530c (diff)
downloadopenttd-1d85d71d29b8d554e9304f3feb6c26f8b9faea82.tar.xz
Fix: for original terrain generator, keep a single gap of water at the borders (#7883)
This means that for NE/NW, it should have one more in case of freeform-edges, and in case of SE/SW it should have one less. Reminder: freeform-edges only adds VOID tiles on X=0 and Y=0.
Diffstat (limited to 'src')
-rw-r--r--src/landscape.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index f09bdcaff..33afd5163 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -865,7 +865,8 @@ static void GenerateTerrain(int type, uint flag)
uint x = r & MapMaxX();
uint y = (r >> MapLogX()) & MapMaxY();
- if (x < 2 || y < 2) return;
+ uint edge_distance = 1 + (_settings_game.construction.freeform_edges ? 1 : 0);
+ if (x <= edge_distance || y <= edge_distance) return;
DiagDirection direction = (DiagDirection)GB(r, 22, 2);
uint w = templ->width;
@@ -900,8 +901,8 @@ static void GenerateTerrain(int type, uint flag)
}
}
- if (x + w >= MapMaxX() - 1) return;
- if (y + h >= MapMaxY() - 1) return;
+ if (x + w >= MapMaxX()) return;
+ if (y + h >= MapMaxY()) return;
TileIndex tile = TileXY(x, y);