summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-03 18:20:43 +0000
committertron <tron@openttd.org>2005-02-03 18:20:43 +0000
commit0601293edb1bd854ad304c9777c3d90864db76fe (patch)
tree97ae3228d733702f433692f9796f87ab652044cb
parent1938a73c90db32244162a927e51c1903fed779f9 (diff)
downloadopenttd-0601293edb1bd854ad304c9777c3d90864db76fe.tar.xz
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
-rw-r--r--landscape.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/landscape.c b/landscape.c
index 0f7ca507b..a9a9d6891 100644
--- a/landscape.c
+++ b/landscape.c
@@ -533,22 +533,26 @@ static void GenerateTerrain(int type, int flag)
p += 8;
if (flag & 4) {
- if (!(flag & 2)) {
- if (!(flag & 1)) {
- if (x + y > 190)
- return;
- } else {
- if (y < 30 + x)
- return;
- }
- } else {
- if (!(flag & 1)) {
- if (x + y < 256)
- return;
- } else {
- if (x < 30 + y)
- return;
- }
+ uint xw = x * MapSizeY();
+ uint yw = y * MapSizeX();
+ uint bias = (MapSizeX() + MapSizeY()) * 16;
+
+ switch (flag & 3) {
+ case 0:
+ if (xw + yw > MapSize() - bias) return;
+ break;
+
+ case 1:
+ if (yw < xw + bias) return;
+ break;
+
+ case 2:
+ if (xw + yw < MapSize() + bias) return;
+ break;
+
+ case 3:
+ if (xw < yw + bias) return;
+ break;
}
}